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. Author

    Andrew: Do you have WSUS setup? If so, see if those patches that are downloaded are the express MSUs. If not, you could point your script at that content location.

  2. Author

    Just checking back with you Andrew. I think the problem with the express updates is that the source computer was synced with Windows Update and not WSUS (without express updates enabled).

    Can you confirm?

  3. DF 8 years ago

    Joseph,

    I can confirm that WSUS with express updates disabled will provide the required non-express cabs. Public windows updates provides mostly express updates.

  4. Carlos 8 years ago

    Hi.

    I found your way of doing it very interesting and straight forward.

    My issue is: I get an error every time!!!!

    Deployment Image Servicing and Management tool
    Version: 6.3.9600.17031

    Error: 4390

    An error occurred while attempting to start the servicing process for the image located at r:\Mount.
    For more information, review the log file.

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

    —–

    LOG:

    [3600] ImageUnmarshallHandle: Reconstituting wim at r:\temp\install.wim.
    [3600] ImageUnmarshallHandle: Reconstituting wim at r:\temp\install.wim.
    2014-11-20 14:56:24, Info DISM DISM Manager: PID=3600 TID=6104 physical location path: r:\Mount – CDISMManager::CreateImageSession
    2014-11-20 14:56:24, Error DISM DISM Manager: PID=3600 TID=6104 Failed to create unique image session lock name for DISM located at ‘r:\Mount\Windows\System32\Dism\dismprov.dll’. – CDISMManager::CheckSessionAndLock(hr:0x80071126)
    2014-11-20 14:56:24, Error DISM DISM Manager: PID=3600 TID=6104 Failed to create the image session lock for location: r:\Mount\Windows\System32\Dism – CDISMManager::CreateImageSession(hr:0x80071126)
    2014-11-20 14:56:24, Error DISM DISM.EXE: Could not load the image session. HRESULT=80071126
    2014-11-20 14:56:24, Error DISM DISM.EXE: Unable to start the servicing process for the image at ‘r:\Mount’. HRESULT=80071126
    2014-11-20 14:56:24, Info DISM DISM.EXE: Image session has been closed. Reboot required=no.

    Thanks in advance for your help!

  5. Author

    How far into the script do you get? It appears you aren’t even getting the install.wim mounted in the first line. Is that true?

  6. Carlos 8 years ago

    Hi, Joseph

    Thanks for the reply!

    1st my specs: 32GB RAM (where 20GB are allocated for my RAMDRIVE) and Windows 8.1 x64 Update 1 (and all the latest updates too including KB3000850 ~ 700MB in size).
    ADK for Windows 8.1 (full updated).

    2nd My steps: I copy (with 7zip) the install.wim from my ISO (MS official ISO from windows 8.1 with update 1) to my R: drive (that’s the RAMDRIVE where things go really fast). The file is in the ‘Sources’ folder.
    1- I managed to extract the info from the install.wim as shown below:

    R:\>dism /get-wiminfo /wimfile:r:\install.wim

    Deployment Image Servicing and Management tool
    Version: 6.3.9600.17029

    Details for image : r:\install.wim

    Index : 1
    Name : Windows 8.1 Pro
    Description : Windows 8.1 Pro
    Size : 12 597 421 853 bytes

    The operation completed successfully.

    R:\>
    2- I managed to mount the file:
    R:\>dism /mount-wim /wimfile:r:\install.wim /mountdir:r:\mount /index:1

    Deployment Image Servicing and Management tool
    Version: 6.3.9600.17029

    Mounting image
    [==========================100.0%==========================]
    The operation completed successfully.

    R:\>

    3-Now the fun starts. Get info on the mounted file:

    R:\>dism /get-mountedwiminfo

    Deployment Image Servicing and Management tool
    Version: 6.3.9600.17029

    Mounted images:

    Mount Dir : r:\Mount
    Image File : r:\install.wim
    Image Index : 1
    Mounted Read/Write : Yes
    Status : Ok

    The operation completed successfully.

    R:\>

    4-Trying to service it 🙁

    R:\>dism /image:r:\Mount /add-package /packagepath:r:\patches\Windows8.1-KB3000850-x64.msu

    Deployment Image Servicing and Management tool
    Version: 6.3.9600.17029

    Error: 4390

    An error occurred while attempting to start the servicing process for the image located at r:\Mount.
    For more information, review the log file.

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

    R:\>

    5-I get this specific error everytime!!! Even if I change the .msu or .cab update. I can’t get this error out (4390)!!

    6- Now to ‘unmount’ the image:
    R:\>dism /unmount-wim /mountdir:r:\Mount /discard

    Deployment Image Servicing and Management tool
    Version: 6.3.9600.17029

    Image File : r:\install.wim
    Image Index : 1
    Unmounting image
    [==========================100.0%==========================]
    The operation completed successfully.

    R:\>

    7-I am not using ‘/commit’ because I am not able to apply any updates.

    8-I created a Windows 7 x64 virtual machine (vbox) and I get the same result. Once and only once it applied one update (.cab), I don’t know how because it was doing this some 4390 error over and over.
    Thanks for your time, Joseph
    Best regards,

    Carlos.

  7. Carlos 8 years ago

    Hello, Joseph

    Well, I finally made it!!!

    It looks like it doesn’t like the RAMDRIVE (although it’s NTFS formatted and never gave me any kind of issues with other apps).
    If I redirect the ‘mount’ dir to my C: drive, everything works great!
    Take a look:
    ————————

    R:\>dism /get-wiminfo /wimfile:r:\install.wim

    Deployment Image Servicing and Management tool
    Version: 6.3.9600.17031

    Details for image : r:\install.wim

    Index : 1
    Name : Windows 8.1 Pro
    Description : Windows 8.1 Pro
    Size : 12 597 421 853 bytes

    The operation completed successfully.

    R:\>dism /mount-wim /wimfile:r:\install.wim /mountdir:c:\mount /index:1

    Deployment Image Servicing and Management tool
    Version: 6.3.9600.17031

    Mounting image
    [==========================100.0%==========================]
    The operation completed successfully.

    R:\>dism /get-mountedwiminfo

    Deployment Image Servicing and Management tool
    Version: 6.3.9600.17031

    Mounted images:

    Mount Dir : c:\mount
    Image File : r:\install.wim
    Image Index : 1
    Mounted Read/Write : Yes
    Status : Ok

    The operation completed successfully.

    R:\>dism /image:c:\Mount /add-package /packagepath:r:\patch\

    Deployment Image Servicing and Management tool
    Version: 6.3.9600.17031

    Image Version: 6.3.9600.17031

    Processing 1 of 1 – Adding package r:\patch\Windows8.1-KB2934018-x64.msu
    [==========================100.0%==========================]
    The operation completed successfully.

    R:\>dism /unmount-wim /mountdir:c:\Mount /commit

    Deployment Image Servicing and Management tool
    Version: 6.3.9600.17031

    Image File : r:\install.wim
    Image Index : 1
    Saving image
    [==========================100.0%==========================]
    Unmounting image
    [==========================100.0%==========================]
    The operation completed successfully.

    R:\>
    —————————————–
    I was having problems with Winreducer8.1 too. Perhaps the problem is the RAMDRIVE (driver?).
    Big thanks for your support.
    Maybe, this post will save someone a lot of time if they are using a RAMDRIVE.

    Best regards,

    Carlos

  8. Author

    That is awesome Carlos! And thank you for posting your solution – it will certainly help someone else!

  9. Carlos 8 years ago

    Hi, Joseph

    I’am using this RAMDRIVE —> http://reboot.pro/files/file/284-imdisk-toolkit/

    It’s free and a great tool. Never had a glitch with it until “dism”.

    I don’t know about other RAMDRIVE’s software. Perhaps, if somebody else is using another driver, please post the results.

    This RAMDRIVE is an excellent HHD/SSD life saver. It really avoids a lot read/writing on these drives. You’ll love a RAMDRIVE if you work with large files like ISOs and compressed files.

    My customized Win81 is now 6.46GB in size (has 87 slipstreammed updates).

    It would be great to have something like this for Office 2013 (right now it has over than 2GB in updates).

    Thanks for a great tutorial here. Keep up!

    Carlos.

  10. ferrix 8 years ago

    I confirm that the “express” cabs will not work with DISM. For the moment I am using “Windows Updates Downloader” (http://www.windowsupdatesdownloader.com/) to grab all available updates for my platform and dump them into a single folder. Then I use the above instructions to DISM mount/loop/commit . Haven’t finished yet to prove that it all completely works and installs, but I thought I’d at least share my findings while I’m waiting for the packages to add 🙂

    This procedure is not perfect, because the downloader’s list files are not updated instantly (as of this writing, it is like 3 months out of date). But it’s a lot better than having to hunt up 100 download links myself.

    I can barely believe Microsoft makes this so difficult. Not every case is suitable for WSUS or SCCM. But without arcane knowledge and a ton of utilities it’s nearly impossible to start with an updated image!

  11. ferrix 8 years ago

    Also, user-contributed (more up to date sometimes) lists for above tool, at http://www.msfn.org/board/forum/166-user-contributed-update-lists/

  12. Alex T 8 years ago

    I couldn’t get this method to work reliably. In the end I’ve turned to a two-prong method.
    Download the updates using Windows Update Downloader – http://www.windowsupdatesdownloader.com/, and then build my image using NTLite (beta) – http://www.ntlite.com/
    NTLite seems to use DISM when it builds the image, but can do a lot of the customisation for you.

  13. Carlos 8 years ago

    Hi,

    Is there a preferred order to integrate updates (general, hotfix, security, SP)????

    Thanks in advance.

    Carlos

  14. ferrix 7 years ago

    It seems to me that it would be most sensible to go in chronological order of release, in that manner trying to prevent anything new from being overwritten with something older. I don’t know how likely that is, but the documentation suggests that using DISM may not respect ordering and dependencies: “You can either apply an unattend answer file to the offline image, or you can add or remove the package directly from the command prompt. If you are installing multiple packages to a Windows image, and there are dependency requirements, the best way to ensure the correct order of the installation is by using an answer file”

  15. Author

    Carlos – always start with an installation media with the latest Service Pack already integrated. From there, the integration order doesn’t really matter.

    Ferris – That does make the most sense. If you are using SCCM (or have this ability elsewhere), you can build a list of updates that excludes expired and replaced packages.

  16. William Petti 7 years ago

    Great article! I’m stuck…I can mount the .wim fine but when I go to the next step and use the command:

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

    After I insert the name of my machine it opens a new cmd but justs sits there and does nothing. I also tried pointing the it to my local machine to get the updates and it says that it can’t find the file specified.
    Any help would be great! Thanks.

    William

  17. Author

    Thank you William!

    First, can you browse to \\UPDATEDMACHINE\C$\Windows\SoftwareDistribution\Download\ ?

    If so, can you RDP into that machine, mount the WIM file there, and run the above start command?

  18. William Petti 7 years ago

    Thanks Joseph.

    I did as you instructed on the local machine. The first update processes successfully but every one after that says “The system cannot find the file specified”

    William

  19. Author

    When it imports the update and fails, can you browse to the exact path specified in the command?

  20. William Petti 7 years ago

    Yes sir I can.

    I let it run through and some of them processed but the majority failed.

    William

  21. Author

    Are you using express cabs? See the comments above on that issue.

  22. William Petti 7 years ago

    Thanks for your help Joseph! I was using express cabs. I finally got the full cabs downloaded last night so I’m moving forward.

    BTW I just started reading DeployHappiness. Who are you…haha?? This is good stuff!

    William

  23. Author

    Awesome! And thank you! 🙂

  24. William Petti 7 years ago

    I’ve been a sys admin for 14 years and most of the time I think I know everything but then I meet someone like you and realize I don’t know anything!

    Thanks again.

  25. Author

    🙂 I stand on the shoulders of giants.

Leave a reply to ferrix Click here to cancel the reply

Please enclose code in pre tags

Your email address will not be published.

*

© 4sysops 2006 - 2022

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