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!
This entry was posted on Sunday, April 11th, 2010 at 11:57 pm and is filed under Windows Server 2008 R2. Find similar posts by selecting any of the following tags: imaging, wds. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
Have your say
Fields in bold are required. Email addresses are never published or distributed.
Some HTML code is allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>URIs must be fully qualified (eg: http://www.domainname.com) and all tags must be properly closed.
Line breaks and paragraphs are automatically converted.
Please keep comments relevant. Off-topic, offensive or inappropriate comments may be edited or removed.