DISM can preload Windows Update packages into your images. This guide will show you how to use DISM to load updates and includes a nearly automated way to slipstream 100+ updates at once.

Update: If you are looking for a way to download updates read this  and this new article explains how to slipstream updates with  PowerShell and SCCM.

If you have ever watched a fresh OS install download update after update, you understand how frustrating and time consuming it can be. There are several solutions that will ensure a new machine is completely patched before the end user even gets the machine. For example, MDT includes two separate tasks for updating a machine during a task sequence.

The Windows Update Task in a MDT Task Sequence can slow down imaging

The Windows Update Task in an MDT Task Sequence can slow down imaging.

Another common method is to load Windows Update packages into the MDT Deployment Workbench Packages container.

The downside to most methods is the increase in imaging times. When you are installing 150+ updates on a Windows 7 machine, things can slow down to a crawl.

One great alternative is to use DISM and the /add-package parameter. With DISM and a simple batch file, we can loop through Windows Update packages and apply them to our .WIM files. Let’s briefly cover DISM and prep our environment before jumping into the cooler stuff.

Using DISM to install Windows Update packages ^

Start by creating a folder in the root of C:\. Name the folder Mount. Next, launch an administrative command prompt (WIN + X, A for Windows 8+ machines) and execute DISM to see the list of available options and the proper syntax. If you have ADK installed, you can launch the Deployment and Imaging Tools Environment shortcut as an administrator. This is my preferred method.

Getting help with DISM is made easier with command prompt examples

Getting help with DISM is made easier with command prompt examples.

Your first step is to mount your OS install.wim file. If you are using MDT, this file is located in your DeploymentShare under Operating Systems\OS Name\sources\. At your administrative command prompt, type the following:

dism /mount-wim /wimfile:”D:\DeploymentShare\Operating System\Windows 7 SP1\Sources\install.wim” /mountdir:C:\Mount /index:1

When the WIM is mounted, you should be able to browse to C:\Mount and view the contents.

A mounted WIM within Windows Explorer. An OS within an OS

A mounted WIM within Windows Explorer. An OS within an OS.

To add a Windows update, type the following command:

dism /image:C:\Mount /add-package /packagepath:PATH-TO-UPDATE

Adding updates with the above command is almost as tedious as watching 150 of them install. In the past, I would head to the Windows Update catalog and download every update that was needed. Although I will still do this for some single updates, I use a faster method now.

The easier way to slipstream Windows updates ^

To use this method, you will need to set up a fresh machine and let it fully update. This has to be done for each OS that you deploy. Luckily, you will only have to do this one time. When your first machine is fully patched, head back to your administrative command prompt and type the following:

Start /w for /R \\UPDATEDMACHINE\C$\Windows\SoftwareDistribution\Download\ %f in (*.cab) do DISM /image:C:\Mount /add-package /packagepath:”%U”

Be sure to specify your machine’s name in the command. This will launch a new window where you can watch as each update is installed. Even though this part is automated, it will still take a while to complete (about an hour for my test VM).

DISM successfully adding Windows Updates to our WIM

DISM has successfully added Windows updates to our WIM.

Once you are at the return prompt in the second window, all available updates have been slipstreamed. Head back to your first command prompt and type:

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

At this point, DISM will apply the changes that you’ve made, save your image, and unmount it. Your local Mount folder should now be empty. To speed up this process on other operating systems, save the following commands in a batch file:

dism /mount-wim /wimfile:”D:\DeploymentShare\Operating System\Windows 7 SP1\Sources\install.wim” /mountdir:C:\Mount /index:1
Start /w for /R \\UPDATEDMACHINE\C$\Windows\SoftwareDistribution\Download\ %f in (*.cab) do DISM /image:C:\Mount /add-package /packagepath:”%U”
Dism /unmount-wim /mountdir:C:\Mount /commit

Deploy your fully patched image to a test computer. Once the install finishes, check Windows Updates for any available updates. You should notice a drastic reduction! In my case, only updates that install with an EXE were still available. From here, you can deploy those remaining updates with WSUS or MDT Applications, or you can allow the Windows Updates task to finish the job.

Update: If you are looking for a way to download updates read this  and this new article explains how to slipstream updates with  PowerShell and SCCM.

155 Comments
  1. Jeff Bowman 6 years ago

    Well now this is strange!

    In the entire C:\Windows\SoftwareDistribution hierarchy on a fully patched Win8.1 machine, I have only one—one—KB update:

    windows8.1-kb2976978-v10-x64-express.cab

    What's to be made of it?

    Thanks,
    Jeff Bowman
    Fairbanks, Alaska

  2. Author

    Any chance your machine had updates slipstreamed into before hand (or you ran the resetbase command in powerhsell)?

  3. Jeff Bowman 6 years ago

    > Any chance your machine had ...

    Not a chance. Big mystery, that.

    Guess I'll just have to find another way to get 'em. Great article!

    Thanks,
    Jeff Bowman
    Fairbanks, Alaska

  4. Author

    Thank you Jeff!

  5. Author

    Thank you for posting back this solution Jeff!

  6. Jeff Bowman 6 years ago

    You're welcome 🙂

    Joe Wright's post doesn't replace yours here—they're just two different ways of tackling the same sticky problem.

    Thanks,
    Jeff Bowman
    Fairbanks, Alaska

  7. I inject the packages PRE starting the machine.

    First download the monthly ISO packages from https://support.microsoft.com/en-au/kb/913086.

    Then mount the ISO and mount the VHD/X.

    Then run something like, where h: is the ISO drive and g: is the VHDX.

    dir h: -Recurse -Include *.msu,*.cab | ForEach-Object {Add-WindowsPackage -PackagePath
    $_.FullName -Path g: -LogPath .\packages.log -LogLevel 2}

  8. Author

    Thank you for your solution Andrew!

  9. BlueCamo 6 years ago

    Joseph, what exactly does the %U% or %F% reference after the /packagepath? Thanks.

  10. Author

    It is a foreach loop.

    I should probably re-write this in PowerShell completely.

  11. A Kofoed 6 years ago

    I'm trying this, but it give an error when running the command

    Start /w for /R \\DEPLOYMENY-64\C$\Windows\SoftwareDistribution\Download\ %f in (*.cab) do DISM /image:C:\Mount /add-package /packagepath:

    tried the /packagepath:%f and %u and with and without ""

    keep getting the errors:

    -------------------------------------------------------------------------
    C:\Windows\System32>DISM /image:C:\Mount /add-package /packagepath:"%U"

    Deployment Image Servicing and Management tool
    Version: 6.3.9600.17031

    Image Version: 6.1.7601.18489

    An error occurred trying to open - "%U" Error: 0x80070003

    Error: 3

    The system cannot find the path specified.

    The DISM log file can be found at C:\Windows\Logs\DISM\dism.log

    -----------------------------------------------------------------------------

    C:\Windows\System32>DISM /image:C:\Mount /add-package /packagepath:\\DEPLOYMENY-
    64\C$\Windows\SoftwareDistribution\Download\1a72828373c82bbf5de3f9525ce6dce8\ie1
    1-windows6.1-kb3093983-x64-express.cab

    Deployment Image Servicing and Management tool
    Version: 6.3.9600.17031

    Image Version: 6.1.7601.18489

    Processing 1 of 1 - Adding package Package_for_KB3093983~31bf3856ad364e35~amd64~
    ~11.2.1.0
    [===========================66.1%====== ]
    An error occurred - Package_for_KB3093983 Error: 0x800f0816

    Error: 0x800f0816

    DISM failed. No operation was performed.
    For more information, review the log file.

    The DISM log file can be found at C:\Windows\Logs\DISM\dism.log

    ""
    VersionComp: EQ, ServiceComp: EQ, BuildComp: EQ, DistributionComp: GE, RevisionComp: GE, Exist: present
    2015-10-16 09:55:43, Info CBS Appl: detectParent: package: Package_31_for_KB3037574~31bf3856ad364e35~amd64~~6.1.1.0, no parent found, go absent
    2015-10-16 09:55:43, Info CBS Appl: detect Parent, Package: Package_31_for_KB3037574~31bf3856ad364e35~amd64~~6.1.1.0, Parent: WinEmb-NetFx20~31bf3856ad364e35~amd64~hr-HR~6.1.7601.17514, Disposition = Detect, VersionComp: EQ, ServiceComp: EQ, BuildComp: EQ, DistributionComp: GE, RevisionComp: GE, Exist: present
    2015-10-16 09:55:43, Info CBS Appl: detectParent: package: Package_31_for_KB3037574~31bf3856ad364e35~amd64~~6.1.1.0, no parent found, go absent
    2015-10-16 09:55:43, Info CBS Appl: detect Parent, Package: Package_31_for_KB3037574~31bf3856ad364e35~amd64~~6.1.1.0, Parent: WinEmb-NetFx20~31bf3856ad364e35~amd64~lt-LT~6.1.7601.17514, Disposition = Detect, VersionComp: EQ, ServiceComp: EQ, BuildComp: EQ, DistributionComp: GE, RevisionComp: GE, Exist: present
    ""

    I can't find any help threads for this issue?

  12. SCott 6 years ago

    I tried the command as it was displayed and had the same problem as A Kofoed. This worked for me.
    1. mounted the image to C:\Mount
    2. Opened elevated command prompt
    3. Start /w for /R C:\Windows\SoftwareDistribution\Download\ %F in (*.cab) do DISM /image:C:\Mount /add-package /packagepath:"%F"
    I think he had "%U" which did not seem to work. Maybe a typo?

  13. A Kofoed 6 years ago

    SCott: its not a typo, since i tried both %F and %U with and without "" (se my post again)

    I now tried this on the Updated PC and it does the same error, this is fustrating

  14. miki43 6 years ago

    Hey i think you are too much complexed with this for loop.You could easily write this like this (Start /w for /R "%windir%\SoftwareDistribution\Download\" %f in (*.cab) do DISM /image:C:\Mount /add-package /packagepath:%f).But it looks like in DISM quotes make error in both first one and for loop too so i tried every one of them without quotes and it works.

  15. Karl Thornley 6 years ago

    Re: Express updates. In an SCCM environment you can get around this by using the appropriate update package as a source for the CABs. If you're using WSUS, you can use the WSUS content subfolder. However, you'll also pick up a load of Office updates in all likelihood which won't install by this method. Alternatively, set up a subordinate WSUS server, configure it only to sync OS updates with your main server, approve the required updates on this server then use its content subfolder once it's finished downloading.

  16. Karl Thornley 6 years ago

    Incidentally, I also find that sometimes DISM hangs after installing an update with the last line in the logfile being 'Releasing the local reference to DISMLogger. Stop logging. - CDISMProviderStore::Internal_DisconnectProvider' - you have to kill the DISM process for it to go on to the next update. If you don't, DISM uses all the available CPU for a while and gradually increases in memory use. Sometimes it falls out the end, sometimes not.

  17. michael 6 years ago

    I am following your guide, and I can't get it working, maybe I am doing something wrong. I get the message: An error occured tring to open - % Error: 0x80070003. Doesn't matter if I tried -%f or "%f" or "%u" --- no idea what I am doing.

    Here is the step I took:

    1) copy os image to c:\
    2) mounted image (had to figure out what all these paths were, was getting error: 123)
    3) used your "The easier way to slipstream Windows updates" (had to find out how to get pc name)
    4) I get the message An error occured tring to open - % Error: 0x80070003

    After some googling, someone asked the question if they are using WinPE or Windows. I am doing this via Windows OS (active). Was I supposed to uses some software like WinPE? Didn't see it mention here. A dummy step by step guide would be appreciated.

  18. Author

    I'm not sure exactly why you are getting that error but you don't need to be in Windows PE for this script to run.

  19. Anonymous 6 years ago

    I am not sure if it is relevant, but this error appears to be an association of being used by windows system; at least that's what google says.

  20. michael 6 years ago

    googling says its being used by system OS as the reason why this error.

  21. Ray 6 years ago

    Hi i just used this command to update a windows 7 ultimate wim.

    I removed the "%U" at the end of the linde and replaced it with just a %f

    With no quotation marks and it worked fine.

  22. Ray 6 years ago

    My guess is if you don't have a space in the path to your windows updates folder, then it should work with the %f variable instead of the "%U"

  23. michael 6 years ago

    ok i give up on this method, all i get is more errors using %f

  24. Karl 6 years ago

    I've noticed that if you view the dism.log file in, for example, Trace32.exe (SCCM Log File Viewer, very useful for monitoring logs in real time) sooner or later an update will hang on finishing and the memory usage of dism.exe will go up and up until it crashes with a memory exception.

    Leave it and don't view the log file, and its fine. Even viewing the log file from another computer causes this behaviour

Leave a reply

Please enclose code in pre tags

Your email address will not be published. Required fields are marked *

*

© 4sysops 2006 - 2021

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account