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

“C:\w7updateslip\download\”
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.

Join the Conversation

5 Comments

  1. Hi, I’m getting halted by an the below error. Could you please help?

    An error occurred trying to open – C:win10updatesdownload182be7db7fba6c25eeb1bb3c8c275f09Abm_c3372ac7-0d4f-4a27-b512-819d45dc9ab8.cab Error: 0x8
    0070002

    Error: 2

    The system cannot find the file specified.

    The DISM log file can be found at C:WindowsLogsDISMdism.log

  2. The directory of the cab it’s trying to find is browse able but for some reason it’s outputting the error “The system cannot find the file specified”. Could also access it via the path.

    Trying to slipstream updates for windows 10 pro

    Thanks a lot!

Leave a comment