Share This Post

How to Offline Patch ALL your .WIM images using DISM and PowerShell

I was watching my Twitter feed the other day and saw that Brandon Linton posted an excellent blog about How to Offline Patch a .WIM image using DISM. This is an excellent technique for injecting all of those Windows hotfixes that are not available via WSUS or just to quickly inject new patches without having to completely rebuild your images.

Where I work, we really only build images once per quarter and take care of interim patching using SCCM. In addition to leveraging Michael Niehaus’ MDT Image Factory, we wanted to automate this process also. Off to PowerShell!

DISCLAIMER – I use a very specific naming convention that is HARD CODED into the PowerShell script to identify the Operating System that the WIM file contains. I also use images that have a single index. You can modify the code if you need to deal with multiple indexes or change the .WIM file names the script looks for. I have these names set as the MDT Task Sequence ID’s in the MDT Image Factory linked above.

The first thing I needed to do in order to automate this process is setup a directory structure for storing all of the hotfixes we inject (the ones not available via WSUS). We’ll call it “SoftwareUpdates” (Note the absence of a space here, it’s very important).


Next, we need a Mount directory to actually mount the .WIM file using DISM to perform the offline patching operations. In the same directory as “SoftwareUpdates”, we’ll create another directory called “mount”. So here is our directory structure. Very simple containing only our PowerShell script, SoftwareUpdates directory, mount directory and any .wim images you may want to patch.

Now let’s dive into the SoftwareUpdates directory and see how that’s setup. As you can see below, we have created additional directories for each of the operating systems where we will store our .msu update files.


And here are the contents of the Win7x64 directory for good measure:


Now all you need to do is run the PowerShell script attached to this post and it will mount each of your .WIM files (assuming they are appropriately named), patch and commit the changes and move on to the next until all available .WIM files have been patched!

Get the script!

Share This Post


  1. Exclude KB2533552. Will crash. cant install offline.

    • I have no choice but to trust him, being from the future and all.

Leave a Reply