Here’s a small script for any of you WDS/MDT wizards out there

Going by the age old motto of “Once you’re totally sick of doing something manually, script it!” I wrote the below

### Update Deployment Share ### # Import MDT Toolkit Import-Module "C:Program FilesMicrosoft Deployment ToolkitbinMicrosoftDeploymentToolkit.psd1" # Get all exisiting boot images and remove them Get-WdsBootImage | Remove-WdsBootImage # Loop through all deployment shares in "D:Deployment Shares" and do the following... # 1. Make a PS Drive for it # 2. Update it # 3. Import it to WDS # 4. Remove the PS Drive $DeploymentShares = Get-ChildItem -Path 'D:Deployment Shares' foreach ($DeploymentShare in $DeploymentShares) { $DSName = $($DeploymentShare.name) $DSPath = $($DeploymentShare.fullname) New-PSDrive -Name $DSName -PSProvider MDTProvider -Root $DSPath -Verbose update-MDTDeploymentShare -Path "$($DeploymentShare.name):" -Verbose Import-WdsBootImage -NewImageName $DSName -NewDescription $DSName -Path "$DSPathBootLiteTouchPE_x64.wim" -Verbose Get-PSDrive -Name $DSName | Remove-PSDrive -Verbose } 

I just have this saved on the desktop of my WDS server and right click “run with powershell” and can carry on with something else…

one MAJOR warning thoughyoushouldhavereaditfirst

It will remove all boot images when you run it! (it puts the new ones in at the end)

Some things you may need to customise:

  • it assumes your deployment share path (D:Deployment Shares)
  • it won’t import any 32-bit images, you can just copy/paste the line and change it.

I accept no responsibility if this cocks up your deployment server!

submitted by /u/elliottmarter
[link] [comments]

Leave a Reply