Automating Long-Running MDT 2010 Tasks

There are a few operations in the MDT 2010 Deployment Workbench that can take a while.  We’ve done our best to optimize those processes, but in many cases they will still take a good amount of time to complete.  While you could certainly start an operation in one Deployment Workbench and then open another Deployment Workbench so that you can continue working, it would be even better to schedule these long-running tasks so that they run automatically, ideally when you are sleeping and when there aren’t any active Lite Touch deployments going on.

Fortunately, since the Deployment Workbench is now PowerShell-based you can now write simple PowerShell scripts to perform these activities.  The following three samples show you how to do it.

Sample #1:  Updating a deployment share

The “Update Deployment Share” process takes the latest changes made to the deployment share (bootstrap.ini updates, new drivers, new patches, script changes, etc.) and updates the Windows PE boot images (WIM files and ISOs if requested).  Depending on the extent of the changes, this process might take 15-30 minutes (depending on the I/O performance of the machine – it’s definitely an I/O-bound process, especially for the WIM and DISM actions performed by this process).  The following script will automate the process:

Start-Transcript C:\Scripts\UpdateDeploymentShare.log

# Connect to the deployment share
Add-PSSnapIn Microsoft.BDD.PSSnapIn
New-PSDrive DS002 MDTProvider \\MTN-SERVER\Distribution$

# Update the deployment share
Update-MDTDeploymentShare -Path DS002: -Verbose


Save that as “UpdateDeploymentShare.ps1” and schedule it to run nightly using the Windows Task Scheduler.  The action command line required (assuming you saved the script in C:\Scripts) would be:

PowerShell.exe -File C:\Scripts\UpdateDeploymentShare.ps1

Make sure you have configured PowerShell to allow script execution, e.g. “Set-ExecutionPolicy RemoteSigned”.  And be sure to update the deployment share path above, as I’m sure your deployment share isn’t at \\MTN-SERVER\Distribution$.

Sample #2:  Updating media content

If you haven’t figured out where we moved “media deployment points” in MDT 2010, they now have their own node:  look under the “Advanced Configuration” node in Deployment Workbench and you’ll see the new “Media” node.  You can create one or more media definitions there, specifying what content should be included in the media (by specifying the selection profile to use when copying content to the media), Windows PE settings to use, whether to generate an ISO, etc.

The “Update Media Content” action is what actually does the work, copying the specified content, generating boot images, and (optionally) generating ISOs.  The following script automates this process, looping through each of the media items that you have defined:

Start-Transcript C:\Scripts\UpdateMedia.log

# Connect to the deployment share
Add-PSSnapIn Microsoft.BDD.PSSnapIn -ErrorAction SilentlyContinue
New-PSDrive DS002 MDTProvider \\MTN-SERVER\Distribution$

# Process each of the media items
Get-ChildItem DS002:\Media | % { Update-MDTMedia -Path "DS002:\Media\$($_.Name)" -Verbose }


Save that as “UpdateMedia.ps1” and schedule it to run nightly using the Windows Task Scheduler.  The action command line to run this (assuming again that the script is saved in C:\Scripts) would be:

PowerShell.exe -File C:\Scripts\UpdateMedia.ps1

Again, be sure to edit the path above, as \\MTN-SERVER\Distribution$ is the path to my deployment share, not yours.

Sample #3:  Updating linked deployment shares

Network deployment points, now called linked deployment shares, also have a new home in MDT 2010 Deployment Workbench: look for them under “Advanced Configuration”, in the “Linked Deployment Shares” folder.   These too use selection profiles to specify what content should be replicated, so arrange your folder structures as needed and create a selection profile that includes the required folders.

The “Replicate Content” action performs the actual replication, copying the content specified in the configured selection profile.  It can also optionally generate the boot images for the linked deployment share (although if you want to configure the Windows PE settings for that remote deployment share you’ll need to open that deployment share in the Deployment Workbench to make the changes).  The following script initiates the same process:

Start-Transcript C:\Scripts\UpdateLinkedDS.log

# Connect to the deployment share
Add-PSSnapIn Microsoft.BDD.PSSnapIn -ErrorAction SilentlyContinue
New-PSDrive DS002 MDTProvider \\MTN-SERVER\Distribution$

# Process each of the linked deployment share items
Get-ChildItem "DS002:\Linked Deployment Shares" | % { Update-MDTLinkedDS -Path "DS002:\Linked Deployment Shares\$($_.Name)" -Verbose }


One last time: edit the path above to specify the path (either a local path or a UNC) to your deployment share.  To run this using the Windows Task Schedule, specify an action command line like so:

PowerShell.exe -File C:\Scripts\UpdateLinkedDS.ps1

Comments (4)
  1. DanRisken says:

    Shouldn't the scheduled task command be "powershell.exe -command <path>" rather than "powershell.exe -file <path>"?

  2. Mirfster says:

    I just wanted to say that I found your "Update Media Content" Script very useful. Modified it a little to my scenario, but working great. Thanks for the useful tips!

  3. 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’.

  4. aw says:

    hai, I just want to tell you that I am just very new to blogs and seriously loved this website. More than likely I’m planning to bookmark your blog post .
    You amazingly come with really good posts. Thanks a lot for sharing your blog Microsoft.

Comments are closed.

Skip to main content