MDT – Slipstream Windows Updates into Boot Image with Powershell

The below powershell script will mount your .wim file from your deployment share, to C:\mount (make sure that folder exists). Then it will get updates that you extracted from a Fully updated Windows machine. Those updates can be found in C:\windows\softwaredistribution\ (then copy them to your MDT server so you can slipstream them) . Once you have those supply your path to get-childitem. From there we filter the file names that end in .cab . Then we run a foreach loop so we can work with every single .cab file. From there we get the full path with $cab.fullname and drop it into a variable to enumerate it. I had trouble just passing $cab.fullname that’s why I put it into a variable first. Then the DISM tool adds each package, once done it commits the changes.

If you have any issues with the image you should run the below which will discard changes.

DISM /unmount-wim /mountdir:C:\Mount /discard

So to recap you should replace:
“C:\DeploymentShare\Operating Systems\Windows 7 x64 Pro\sources\install.wim”
With the full path to your install.wim from your MDT deploymentshare

With the path to the .cab files that you got from your fully updated Windows 7 machine. (you should’ve copied these to your MDT server)

dism /mount-wim /wimfile:"C:\DeploymentShare\Operating Systems\Windows 7 x64 Pro\sources\install.wim" /mountdir:C:\Mount /index:1

$cabs = get-childitem "C:\w7updateslip\download\" -Recurse | where-object name -like "*.cab"
foreach ($cab in $cabs) {
$fullcab = $cab.fullname
DISM /image:C:\Mount /add-package /packagepath:$fullcab
} #foreach

Dism /unmount-wim /mountdir:C:\Mount /commit

img 566b79ee97db2


You should see mostly successes, but some will say they are not applicable and will fail, no worries just let it run.

Leave a comment