How to add packages to WIM images
We are moving forward with Windows Deployment Services; imagine that you have already captured your image and are deploying your Windows massively, but you need to apply a fix to it because a bug has been recently discovered. As a Systems Administrator you need to maintain the maximum available security levels in your organization and patching with last hotfixes means the 50% of the work. So, today we are going to expose how to install a Microsoft Update Standalone (.msu) Package to an offline WIM image.
We are going to expose how to do it for Windows Deployment Services (WDS), but this technique is valid to maintain your images up to date no matter if you are using WinPE device or the Windows 7 DVD for deployment. If you want to know how to add drivers to a WIM image please check our previous post How to inject drivers on WIM images.
First of all we need to export your WIM image to mount and manipulate it. To do that go to your WDS server and type the sentence below on an elevated Command Prompt:
**wdsutil /Verbose /Progress /Export-Image /Image:win7_x64_creative_v1
__/ImageType:**Install **/ImageGroup:**Captured **/DestinationImage
/FilePath:**D:\CapturedImages\win7_x64_creative_v1.wim **/Overwrite:**Yes
Once you get your WIM image exported, mount it using The Deployment Image Servicing and Management (DISM) tool available on the Windows Automated Installation Kit (WAIK). Now, open the Deployment Tools Command Prompt with elevated permissions and type:
**dism /Mount-Wim /WimFile:**D:\CapturedImages\win7_x64_creative_v1.wim
/Index:1 **/MountDir:**D:\ImageTemp\CapturedMount
Once mounted (from the same prompt used before) install the Microsoft Update Standalone (.msu) package:
**dism /Image:**D:\ImageTemp\CapturedMount **/Add-Package
/PackagePath:**D:\Hotfixes\977392\Windows6.1-KB977392-x64.msu
It is recommended doing a commit operation after every change to the image. If anything goes wrong you will be able to roll it back. In that case, there is just one change so we can commit and un-mount the image:
**dism /Unmount-Wim /Commit /MountDir:**D:\ImageTemp\CapturedMount
At this point we just need to replace the image in our WDS server:
**wdsutil /Replace-Image /Image:**win7_x64_creative_v1 **/ImageType:**Install
**/ImageGroup:**Captured **/ReplacementImage /ImageFile:**D:\CapturedImages\win7_x64_creative_v1.wim
That’s it! We’ve got our image fully patched and ready for deployment.
For a complete command syntax and more information you can visit the link below: