Automatically update MDT 2010 boot images in WDS

You’ve probably gone through this cycle if you are using WDS to PXE boot computers to start bare metal Lite Touch deployments:

  • Import new drivers or change bootstrap.ini.
  • “Update deployment share” to generate new WIMs.
  • Import new WIMs into WDS.

Fortunately, with the new “update” process in MDT 2010, described in more detail at, it’s pretty simple to add a script to automate this process.  First, the script:

Option Explicit

Dim oShell, oEnv

Set oShell = CreateObject("WScript.Shell")
Set oEnv = oShell.Environment("PROCESS")

If oEnv("STAGE") = "ISO" then

    Dim sCmd, rc

    sCmd = "WDSUTIL /Replace-Image /Image:""Lite Touch Windows PE (" & oEnv("PLATFORM") & ")"" /ImageType:Boot /Architecture:" & oEnv("PLATFORM") & " /ReplacementImage /ImageFile:""" & oEnv("CONTENT") & "\Sources\Boot.wim"""
    WScript.Echo "About to run command: " & sCmd

    rc = oShell.Run(sCmd, 0, true)
    WScript.Echo "WDSUTIL rc = " & CStr(rc)

    WScript.Quit 1

End if

You’ll need to update the image name in the string above if you’ve changed it from the default of “Lite Touch Windows PE (x86)” and “Lite Touch Windows PE (x64)” since the script doesn’t know what you’ve changed the values to.  Save the edited script as something like “C:\Scripts\UpdateExit.vbs”.  Then, edit the “C:\Program Files\Microsoft Deployment Toolkit\Templates\LiteTouchPE.xml” file so that these lines:

<!-- Exits -->
  <Exit>cscript.exe "%INSTALLDIR%\Samples\UpdateExit.vbs"</Exit>

Instead look like this:

<!-- Exits -->
  <Exit>cscript.exe "%INSTALLDIR%\Samples\UpdateExit.vbs"</Exit>
  <Exit>cscript.exe "C:\Scripts\UpdateExit.vbs"</Exit>

Then make a change that requires re-generating the WIM and ISOs, e.g. change something in bootstrap.ini.  You’ll see in the “Update Deployment Share” output the generated WDSUTIL command that updates the boot image in WDS.  If WDS is located on a different server, you’ll need to update the command in the script above to add “/Server:WDSServerName” to the command.  (WDSUTIL must also be available on the machine, so you may need to install the RSAT WDS tools.)

Extra credit for someone who can convert this into a PowerShell script and look up the right boot image name 🙂

Comments (6)
  1. Fred B says:

    Powershell and I even got the image name!  WDSUTIL doesn’t seem to mind spaces in it’s command line structure (odd but this script fails when I used quotes).  Not bad for my first crack at Powershell scripting.

    # The script:


    $Stage = (Get-ChildItem env:STAGE).value

    If ($Stage -eq "ISO") {

       $DeployRoot = (Get-ChildItem env:DEPLOYROOT).value

       If ($DeployRoot -like "\**") {

           $DeploymentServer = $DeployRoot.split("")[2] }

           Else {

           $DeploymentServer = (Get-ChildItem env:ComputerName).value


       # Note that this script is called once for each platform image created (x86, x64)

       $Platform = (Get-ChildItem env:PLATFORM).value

       $Content = (Get-ChildItem env:CONTENT).value

       # Determine the Name of the existing .wim file that exists in the WDS Share

       $WDS_Share = "\$DeploymentServer" + (get-wmiobject win32_share -computername $DeploymentServer | where-object {$ -eq "REMINST"}).name

       $ImageFileName = "$WDS_ShareBoot$PlatformImages" + (dir "$WDS_ShareBoot$PlatformImages" *.wim).name

       # Grab the ‘Friendly Name’ of the WDS Image File

       $ImageName = (((wdsutil /get-imagefile /imagefile:$ImageFileName | select-string -inputobject {$_} -pattern "Image name:*").ToString()).split(":")[1]).trim()

       # Run WDSUTIL to load the image on the server being updated.

       WDSUTIL /replace-image /image:$ImageName /ImageType:Boot /Architecture:$Platform /ReplacementImage /ImageFile:$ContentLiteTouchPE_$Platform.wim /Server:$DeploymentServer



    then adjust LiteTouchPE.xml:

    <!– Exits –>


     <Exit>Powershell.exe "%deployroot%ScriptsWDSupdate.ps1"</Exit>


  2. Fred B says:

    This script worked great until I created my first remote deployment share.  When I updated the remote share’s Boot.wim, The scripts stepped up and replaced my local boot images.

    This resulted in local PXE boot.wim files that set the deployroot to the remote server share.  Worked great but, very slow of course 🙂

    I think I’ll end up disabling the extension in the LiteTouchPE.xml file on the remote share and manually replacing files on those machines.

    If I knew powershell, I think the solution would revolved around remote execution of WDSutil on the server specified in the DEPLOYROOT variable.

  3. Anonymous says:

    Hi Michael,

    I just wanted to add some additional information about this process. In fact, because there isn’t a "POSTWIM" phase it is necessary to do these automated process during "POSTISO" phase and require that "Generate a Lite Touch bootable ISO image" option have been enabled (for LiteTouch Image)

    In addition it is required to have already added these boot images in WDS manually at least one time.

    is it true ?

  4. Mehdi says:

    Hi guys,

    When i use the scirpt i have this message at the end of the update of the deploymentshare.

    About to run command: WDSUTIL /Replace-Image /Image:"Lite Touch Windows PE (x86)" /ImageType:Boot /Architecture:x86 /ReplacementImage /ImageFile:"C:UserstissirmAppDataLocalTemp32MDTUpdate.10468ISOSourcesBoot.wim" WDSUTIL rc = -1056702168  Exit code = 1

    Can you help me?

  5. Eduardo Mozart de Oliveira says:

    Thanks Micael and people that have commented so far!

    Really useful script (VBScript and PS, in comments).

    Sure I will test PS someday.


    I think, that another possibility, we can copy the file to a network share on the server with WDS and add the image from this share. How the file is locally at the WDS Server, the problem described should not happen.

    I did not tested this, only thinking. Maybe worth the try. Maybe someone with the same problem could test and say for us the result.

  6. showbox says:

    Thanks for the great info. I really loved this. I would like to apprentice at the same time as you amend your web site, how could i subscribe for a blog site?
    For more info on showbox please refer below sites:
    Latest version of Showbox App download for all android smart phones and tablets. – It’s just 2 MB file you can easily get it on your android device without much trouble. Showbox app was well designed application for android to watch movies and TV shows, Cartoons and many more such things on your smartphone.
    For showbox on iOS (iPhone/iPad), please read below articles:
    Showbox for PC articles:
    There are countless for PC clients as it is essentially easy to understand, simple to introduce, gives continuous administration, effectively reasonable. it is accessible at completely free of expense i.e., there will be no establishment charges and after establishment
    it doesn’t charge cash for watching films and recordings. Not simply watching, it likewise offers alternative to download recordings and motion pictures. The accompanying are the strides that are to be taken after to introduce Showbox application on Android.
    The above all else thing to be done is, go to the Security Settings on your Android telephone, Scroll down and tap on ‘Obscure sources’.

Comments are closed.

Skip to main content