Note: This blogpost is also posted on my personal blog: itmicah.wordpress.com
One of the great things about the Microsoft Deployment Toolkit (MDT) is that it’s a very open product. All the scripts are customizable, including the Deployment Wizard. We can add new functionality to the deployment procedure and add wizard pages so we can choose to use those new functions (or not) with each new deployment. Microsoft encourages creativity for this particular product. One of the functions I wanted to create a wizard page for was the deployment of updates. I wanted to be able to choose between a quick OS deployment for test purposes (no updates) and a slower, more production worthy deployment (with updates). And since I take my deployment VM on the road with me, I wanted the ability to choose if the updates are downloaded from Microsoft Update or a clients’ WSUS server. The result looks like this:
Here’s how it’s done:
Step one – create a variable
In a standard server task sequence there are two update steps already in place: a pre-application update task and a post-application update task. They’re both disabled by default. We want to turn them on but not by default. So first we’ll need to create a task sequence variable in order to let MDT know if we want to install updates or not. For this we open the customSettings.ini file (or open Deployment Workbench, right-click your Deployment Share, choose properties and go to the rules tab) and add a property. I called it WinUpdate.
[Settings] Priority=Make, Default Properties=WinUpdate, TargetGroup [Default] WinUpdate=No
As you can see I also have a property called TargetGroup. This is not available by default in MDT so if you want to add this functionality to your deployments then read my previous post. I’ve also set the value for my new variable to No in the Default section. This is not required but is simply good practice if you want to make sure the default setting is off.
Step two – edit task sequences
Now that we have a variable to work with we’ll have to edit the task sequence(s). These are the steps you’ll have to go through:
- Open the task sequence in Deployment Workbench
- Go to the Task Sequence tab
- Select the Windows Update (Pre-Application Installation) step
- Go to the options tab
- Uncheck Disable this step
- Click Add – If statement and click OK at the prompt
- Click on If all conditions are true
- Click Add – Task Sequence Variable
- At Variable type WinUpdate, set Condition to equals and type Yes at Value
- Click OK and Apply (just in case)
- Repeat the steps above for the Windows Update (Post-Application Installation) step
Both step should now look like this:
The Continue on error is also checked but that is optional.
Step three – create a custom wizard pane (MDT Wizard Studio)
Now we have accomplished that the Windows Update steps will only run if our brand new variable is set to Yes. To set the variable to yes we’ll create a custom wizard pane. You can do this manually by editing certain xml files in the script folder of your deployment share but I highly recommend that you download and install MDT Wizard Studio. It will make the experience much more pleasant. I’ll assume you’ve done that for the rest of the tutorial.
Open MDT Wizard Studio, go to File – Open , browse to the script folder of your deployment share and click OK. You can now see the structure of the deployment wizard. In the Panes section select the Select Task Sequence pane and click Add. Enter WinUpdate as the pane ID and DeployWiz_WinUpdates as the file name. Select the new wizard pane and enter Windows Updates in the Title field of the Settings tab.
Now go to the HTML tab. Here you can create the contents of the wizard pane using html. You can get creative or use the one I made and customize it to your needs. It’s available here. Just copy/paste everything in. If you click on the Results tab you should get the same result as seen in the picture at the beginning of this blog. When the first radio button is checked the WinUpdate variable gets a value of No. If the second radio button is checked our WinUpdate variable is set to YES. The same goes for the third radio button. If we enter a WSUS server address the WSUSServer variable will be set and if we enter a value for Target group the TargetGroup variable we made in my previous post will be set. If you specify a default value for the WSUSServer and the TargetGroup variable in the CustomSettings.ini it will be filled in automatically.
Now we need to create a validation script for the pane. If we leave this as it is right now the WSUSServer variable will allways be set. That’s no good!! We need to make sure the WSUS Server and Target Group fields are only enabled if the third radio button is selected. For this we need to create a validation script. Go back to the Settings tab and click Add (Not the Add button in the panes section!). In the Choose type prompt select CustomScript in the dropdown list and click OK. Enter DeployWiz_WinUpdates (or whatever name comes to mind) for the filename and click Save. The script that I made can be viewed here. As you can see the names of the first function corresponds with the onclick actions in the HTML code of the pane.
The final thing to do is to define the Initialization and Validations. To do this click Add in the Settings tab. Select the Initialization type en click OK. Enter InitializeWindowsUpdate on the first line. This makes sure that when the wizard pane is initialized the ValidateWindowsUpdate function of the validation script is triggered. Click Add again and this time select the Validation type. Enter ValidateWindowsUpdate on the first line. Now create one more Validation and this time enter ValidateWindowsUpdate_Final on the first line. That’s it! We’re done! You should now see something like this:
Now that we’re done it’s time to test the wizard. You can do this from within Wizard Editor! Go to Wizard and click on Test. You’ll get a table with all the variables, which you can change to simulate different environments. How cool is that! Click Run and voilá! The MDT Deployment Wizard appears! Select a task sequence and click next until you reach your new wizard pane. Test all the radio buttons and see if the text fields get enabled/disabled correctly:
Also if you select option 3 and clear out the WSUS server text field a Required warning should appear and the Next button should disable.
And there you have it, fellow nerds and IT geeks! Our very own custom made Windows Update Microsoft Deployment Toolkit Deployment Wizard pane! That’s a mouthful!
I hope this helped you get a little familiar in the process of creating your own wizard panes.
Edit: I’ve made a small update to this wizard pane. I’ve added the ability to set a default value for both the WSUSServer and the TargetGroup variable using the customsettings.ini (or the bootstrap.ini). This means that we can now set a different default value for each section in the ini file and it will automatically show up in the wizard pane! Cool stuff (if I say so myself)!
[Settings] Priority=Make, DefaultGateway, Default Properties=WinUpdate, TargetGroup [Default] WSUSServer=http://WSUS.Default.section:8530 TargetGroup=Default [10.15.5.1] WSUSServer=http://WSUS.Gateway.section:8530 TargetGroup=Gateway
Edit #2: I’ve made another small update to this wizard pane. I’ve added some intelligence to the initialization section of the validation script. If you set both the WinUpdate (to yes) and WSUSServer variable in your CustomSettings.ini the bottom radio button will be checked automatically. If only the WinUpdate variable is set (to yes) the second radio button will be checked.
[Settings] Priority=Make, DefaultGateway, Default Properties=WinUpdate, TargetGroup [Default] WinUpdate=No [10.15.5.1] WinUpdate=YES WSUSServer=http://WSUS.Gateway.section:8530 TargetGroup=Gateway