Create a custom Deployment Wizard pane for Updates (MDT)

Note: This blogpost is also posted on the peppercrew website.

The Story

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:

Result Update Pane

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:

TaskSequence Update Variable

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:

Wizard Editor - Validation Script   MDT Wizard Editor - end result

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 voliá! 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:

Update Pane option 2
Example 1: Option two selected. The text fields are disabled (greyed out)

Example 1 result
Result of example 1. WinUpdate=YES, no WSUSServer variable

Update Pane option 3
Example 2: Option three selected. The text fields are enabled and filled out.

Example 2 result
Result example 2. WinUpdate=YES and both WSUSServer and TargetGroup are set.

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. If so, drop me a line!

MicaH

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)!  To update just re-download the files using the links in the blog.

Example cs.ini:

[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. To update just re-download (both) the files using the links in the blog.

Example cs.ini:

[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
Advertisements

About MicaH

I'm a Technical Specialist at PepperByte BV (the Netherlands).
This entry was posted in Microsoft Deployment Toolkit (MDT) and tagged , , , , , , , , . Bookmark the permalink.

32 Responses to Create a custom Deployment Wizard pane for Updates (MDT)

  1. Alex says:

    What version of MDT are you running? Is it 2012 or 2013?

    • MicaH says:

      I have both in my environment. I still use MDT 2012 for Windows 2003 deployments but all modern operating systems are deployed with MDT 2013. The wizard pane works on both.

  2. MicaH says:

    Updated version!

  3. Matt says:

    This is really awesome stuff and just what I was looking for to solve my problem. You rock.

  4. SK says:

    Will this work without CM?
    Can I create custom pages with my own settings that use properties non-standard to MDT?

    • MicaH says:

      Yes, it will. In fact, I’ve never used this with Config Manager. And yes, you can create custom pages using properties non-standard to MDT. My TargetGroup variable is non-standard and will serve you as a good example, so be sure to check out my post about that here.

      • SK says:

        Thanks for the swift reply. We don’t use CM in our organisation, so if this was a requirement I wouldn’t want to waste time fiddling around with it, but this is something I have to look deeper into.
        Thanks again.

  5. Gmad says:

    “In the Choose type prompt select CustomScript in the dropdown list and click OK”

    I do not see that as an option, I only see CustomStatement

  6. Jordan says:

    Hello, is it possible to create a spot to customize at the beginning of déployment there is the possibility to enter the user name and the name of the organization?

    • MicaH says:

      Off course there is. In fact, in earlier versions of MDT this was part of the wizard pane where you’d enter the computer name. In recent versions they combined computer name with domain membership at the expense of the user name and organization, probably because it’s not a deployment requirement anymore. But you can definitely create a custom pane where you can enter that information.

    • MicaH says:

      If you need help developing the pane let me know but I think it’s better to try it yourself first. It’s really not that hard and all the information you need is in this post. You just need to create a pane with two text boxes that correspond with the appropriate task sequence variables. The names can be found in the MDT help application. Just look in the Property definition help page.

  7. quadrant6 says:

    Awesome stuff! But it looks like the link here for the VBScript is no longer valid: https://dl.dropboxusercontent.com/u/62204506/Blog/DeployWiz_WinUpdates_VBS.txt

    Any way to restore that? Hoping to have this up and running soon. Thanks!

  8. Stephen says:

    Ok how do you get to or start this wizard? I have read many articles on this wizard but I do not see how to get to this point.

    • MicaH says:

      You must be new to MDT. In that case: welcome! The wizard starts automatically in the WinPE environment. Updating the deployment share will generate an .iso file and/or some LiteTouch.wim files in the Boot folder of your Deployment Share. If you boot a computer from the .iso file or using a PXE solution like WDS to boot from a .wim file you will boot into the WinPE environment and up pops the wizard. If you mount the .iso in a Windows environment you can start the wizard by running the autoexec.bat file in the root of the mounted drive. Hopefully this will make sense to you. If not, try to find some video tutorials on MDT deployment basics. Good luck.

  9. Daniel says:

    I’m not seeing in the script where the actual WSUSServer property is being set. Do the scripts automatically check the values of HTML fields and assign them to properties based on name? When debugging, I don’t actually see the WSUSServer property being changed, which is why I am curious. Thanks for all your effort on this, by the way!

    • MicaH says:

      Hi Daniel. You are correct: the WSUSServer property is not set by the script I created, that’s only for validation purposes. The HTML fields are being processed by MDT. You can check the details on the final wizard pane to check if the properties are being set properly.

  10. Hi MicaH. That’s awesome and it’s really the only template in MDT wizard which I found.
    You did it with Radio buttons and TextBoxes. Do you have something with ListBoxes? The same as “Task Sequence” pane?

    • MicaH says:

      I’ve never created a wizard pane using a listbox. Listboxes like the one on the task sequence pane are (usually) dynamic so there’s more scripting involved, but if you create a static one the same principles that I use in my pane should apply.

    • Daniel says:

      I did this with a drop down list which is probably about the same as a listbox. To iterate the items use “For Each oOpt in listBox.Options” and to check if it’s selected use “If oOpt.Selected Then”. I think “oOpt.Value” gets you the value of the item. Any VB documentation should tell you how to add/remove items. Hope that helps.

  11. First I would like to say this site is great. Kudos to you! In addition I wanted to ask if the steps listed here could be used to create a custom pane in MDT which will contain a list of domains to choose from via a drop down box which the PC will later join? I ask because my organization has about a dozen AD domains a PC can be joined to depending on operating company. After I tackle that beast I will need to find a way to automate the computer’s OU placement based off the answers from several other LTI prompts and variables such a desktop vs laptop vs VM but I will tackle that beast at a later date :).

    Thanks in advance for any help you could offer, especially to a VERY new scripter. (This is my first scripting project.

    • MicaH says:

      Hi coquilostinny. Sure you can use the same steps to create a pane for your organizations domains. Or, depending on your network infrastructure, you could let MDT figure out which domain to join based on the DefaultGateway variable. Different domains usually mean separate networks with separate default gateways. If that is true in your organization you can bypass making a custom pane altogether by making DefaultGateway a high priority in your CustomSettings.ini and creating sections for each gateway with the corresponding settings. That way, you can automate the domain settings by physical location. The same principle applies to assigning settings based on other variables. For instance, you can do this in your CS.ini file:

      [Settings]
      Priority=DefaultGateway,IsLaptop,IsVM,Default
      Properties=

      [Default]
      MachineObjectOU=OU=Computers,DC=MyRealDomain,DC=local
      NetworkLocation=Work
      JoinDomain=MyRealDomain.LOCAL
      DomainAdmin=administrator
      DomainAdminDomain=MyRealDomain
      DomainAdminPassword=password

      [10.1.1.1]
      JoinDomain=mytestdomain.LOCAL
      DomainAdmin=administrator
      DomainAdminDomain=mytestdomain
      DomainAdminPassword=password1

      [IsLaptop]
      MachineObjectOU=OU=Laptops,OU=Computers,DC=MyRealDomain,DC=local

      [IsVM]
      MachineObjectOU=OU=VM,OU=Computers,DC=MyRealDomain,DC=local

      In this example, a computer will be joined to the MyRealDomain domain in the Computers OU by default, but if the Default Gateway of NIC is 10.1.1.1 it will be joined to the MyTestDomain domain. If the device is a laptop the OU will be the laptop OU in the MyRealDomain domain, etc… Of course, the more variables you assign settings to the smarter you have to get. In the above example a VM that is assigned a Default Gateway of 10.1.1.1 will join the test domain but the OU setting is in the real domain, so that will fail. But clever use of the ini structure can still make this work.

      Hopefully I’ve helped you on your way a little. Please let me know if you need help setting up your wizard pane or CS.ini. Last but not least: welcome to the scripting community!

      MicaH

  12. ThomasC. says:

    Hi!
    I have tried creating a similar pane. I have created in a Task Sequence a folder that contains some command lines to Enable TPM and install MBAM client.
    I would like a pane to ask if i want to run tehse commands

    – I have set a condition on the folder to Mbam=Yes
    – In my CS.ini i have added in Properties section Mbam
    – In CS.ini i have set mbam=NO in the default section

    Using the wizard i have created an HTML pane and a custom script with Initialize and validate section just like in your post.
    When i test it i get an error: Object doesn’t support the property or method ‘Mbam.Value’

    Here is my script part:
    Function InitializeMbam
    ‘Get values from CS.ini
    Mbam.Value = Property(“Mbam”)

    ‘Determine the default value
    If UCase(Property(“Mbam”)) = “YES” then
    YesMbam.checked = true
    Else
    NoMbam.checked = true
    End if

    ValidateMbam
    End Function

    Function ValidateMbam
    ValidateMbam = True
    End Function

  13. The next button does not work when I click next , what to do ?
    I use MDT 2013 Update 2.
    Can you take my computer to see what ‘s going on ?

  14. The next button is clickable but nothing else happens .
    The code is :

    Choose a Windows Update option.

    Don’t install Windows updates.

    The operating system will be deployed but no updates will be installed.

     

    Install all Windows updates.

    The operating system will be deployed after which all available updates will be downloaded from the Windows Update site and installed.

     

    Install updates from a WSUS server.

    The operating system will be deployed after which all available updates will be downloaded from a WSUS server and installed. Enter the appropriate WSUS server using the field below.

    WSUS server URL (http://servername:8530):

    * Required 
    WSUS Target Group name (optional):

     

    ————————————————–
    The details of the order are as follows:
    Custom Script: DeployWiz_WinUpdates.vbs
    Validation : InitializeWindowsUpdate
    Initialization : ValidateWindowsUpdate
    Validation : ValidateWindowsUpdate_Final
    ————————————————————-
    DeployWiz_WinUpdates.vbs
    ‘ // ***************************************************************************
    ‘ //
    ‘ // Copyright (c) Microsoft Corporation. All rights reserved.
    ‘ //
    ‘ // Microsoft Deployment Toolkit Solution Accelerator
    ‘ //
    ‘ // File: DeployWiz_WinUpdates.vbs
    ‘ //
    ‘ // Version: 6.2.5019.0
    ‘ //
    ‘ // Purpose: Windows Updates wizard pane validation
    ‘ //
    ‘ // ***************************************************************************

    Option Explicit

    ””””””””””””””””””’
    ‘ Validate Windows Update pane

    Function InitializeWindowsUpdate
    ‘Get values from CS.ini
    WSUSServer.Value = Property(“WSUSServer”)
    TargetGroup.Value = Property(“TargetGroup”)

    ‘Determine the default value
    If UCase(Property(“WinUpdate”)) = “YES” then
    If Property(“WSUSServer”) “” then
    WSUSUpdate.checked = true
    Else
    WinUpdates.checked = true
    End if
    Else
    NoUpdate.checked = true
    End if

    ValidateWindowsUpdate

    End Function

    Function ValidateWindowsUpdate

    Dim IsWSUS

    IsWSUS = WSUSUpdate.checked

    If not isWSUS then

    WSUSServer.disabled = true
    TargetGroup.disabled = true

    Else

    WSUSServer.disabled = false
    TargetGroup.disabled = false

    End if

    If IsWSUS and WSUSServer.value = “” then

    ValidateWindowsUpdate = false
    ButtonNext.disabled = true

    Else

    ValidateWindowsUpdate = true
    ButtonNext.disabled = false

    End if

    End Function

    Function ValidateWindowsUpdate_Final

    If not WSUSUpdate.checked then

    WSUSServer.Value = “”
    TargetGroup.Value = “”

    End if

    ValidateWindowsUpdate_Final = true

    End Function

    • MicaH says:

      Hi Cor, sorry I’ve been absent here for a while. If you still have these issues I’d like to help, but the code you provided is distorted because of html. Is there any way you could share the following files through dropbox or any other online storage solution:

      * DeployWiz_WinUpdates.vbs
      * DeployWiz_Definition_ENU.xml

  15. P.Konen says:

    Hi, I work with MDT 2013 update 2. I get an error while testing in the MDT Wizard Studio.
    “A VBScripts Runtime Error has occured: Error: 500 = Variable is undefined. VBScript code : InitializeTSList. Do you wish to attempt debugging on this script?”
    Can you assist me with this problem. Alvast bedankt voor de moeite.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s