Apply an update to an offline WIM image
Last week after about two years away I had to do some more work on Windows Deployment Services and found myself writing a guide on how to add Windows Updates to an offline WIM file in WDS. It’s really simple so thought I’d share it here.
Firstly you’ll need to log on to your WDS server and export the image ready for servicing. You can do this through the GUI:

But I would suggest doing this through an administrative command prompt (right click, "Run as Administrator") as much of the work from here on in needs the command line anyway:
wdsutil /Export-Image /Image:”Windows 7 Enterprise” /ImageType:Install /ImageGroup:Win7 /DestinationImage /FilePath:D:\Win7Enterprise.wim /Overwrite:Yes
So, if you haven’t opened up an administrative command prompt, do this now. You’ll need to mount your WIM file before you can do any further work, so following the example above:
dism /Mount-Wim /WimFile:D:\Win7Enterprise.wim /Index:1 /MountDir:D:\Mount
Now you’ve mounted your WIM file it’s time to apply your update. I’ve only tried using CAB and MSU files so far so your mileage may vary depending on the update you’re trying to apply. If you’re familiar with using dism to apply patches to your running operating system, or you do a lot of work with Windows Server Core, this command will look very familiar to you! Noe you can use dism to add drivers and to switch features on and off within an offline image too.
dism /Image:D:\Mount /Add-Package /PackagePath:<package_path_and_filename>
Or, to add a driver:
dism /Image:D:\Mount /Add-Driver /Driver:<inf_path_NOT_filename>
So, that’s your updates applied to your offline image. Now, we need to commit these changes to the WIM file – Windows stores the changes rather than writing directly to the WIM file. We’ll use dism again to achieve this:
dism /Commit-Wim /MountDir:D:\Mount
Now, note the code above – this just writes the changes to the WIM file, it doesn’t unmount it. If you’re only doing one change this step can be skipped, but it’s good practice to commit changes after each one – if you do something wrong you can just revert without having to undo hours of work.
So we’re done with the image – let’s unmount it and get ready to re-import it back into WDS. We’ll use dism again:
dism /Unmount-Wim /Commit /MountDir:D:\Mount
There we go! Your new image is ready to be used. However – it’s not much use sitting on your hard disk, is it? We’ll need to stick it back into WDS. Now in this example I’m assuming you want to replace the image you’ve exported. Here’s the code to do that:
wdsutil /Replace-Image /Image:”Windows 7 Enterprise” /ImageType:Install /ImageGroup:Win7 /ReplacementImage /ImageFile:D:\Win7Enterprise.wim
Or if you prefer you could do it via the GUI:

Alternatively you could add the image file as a new image:
wdsutil /Add-Image /ImageType:Install /ImageGroup:Win7 /ImageFile:D:\Win7Enterprise.wim/SingleImage:”Windows 7 Enterprise” /Name:"Windows 7 Enterprise" /Description:"Updated Windows 7 Enterprise"
Hope this helps someone!
cool, that’s good to know
This is a very useful post, the information is correct and the process works as described.
The most difficult thing about servicing WIMs for use with WDS (if you’re not wanting to use the MDT and all of its paraphernalia) is obtaining batches of Windows updates in MSU or CAB format. For example, if you want to download “all important updates since Server 2008 SP2 was released” there is nothing offered by Microsoft to make this easy. It doesn’t appear to be possible to perform any kind of query to get these painlessly from a WSUS server either. Further, the Windows Update Catalog is less than useless for this.
I found myself going into an already built machine and grabbing the CABs from the Download folder in the C:WindowsSoftwareDistribution folder.
Anyway, that was a bit of a related aside!
Great post.
Hi Rob,
thank you for your blog. But these these option /Add-Package won’t work for windows 7 service pack 1. I’ve got the error message”… Add this package to a running operating system using the Online option Error: 0x800f082e”
I also wish there was service pack support, this is crazy not having it available.
How would you do this with several updates? Would you have to do this one-by-one?
Example:
Can I do this?…
dism /Image:D:Mount /Add-Package /PackagePath:d:wsus*.cab
When I attempt to do this I get: “Error: 0×80070003″
Eric C, I just use a for /f command for this. Has worked so far.
dir /b "" > d:\out.txt
for /f "delims=" %i in (D:\out.txt) do dism /Image:D:\Mount /Add-Package /PackagePath:"\%i"
Thanks WordPress!
Between that first set of quotes, and before the \%i, should be the full path to the folder you have the msu files in.
Hi,
It appears that the command below will add a set of drivers rather than one-by-one:-
dism /Image:D:Mount /Add-Driver /Driver:c:driverpackage -recurse
This is assuming the top-level folder structure ends where you state, so for a Dell driver package, it would probably read:
D:DriversWin7x86 -recurse
I’m not sure if the -recurse command works with update packages, but will be trying next week.
Clear, concise, and immensely time-saving. Thanks Rob.