Combining multiple images into a single wim

One of the most useful features of WIM technology is the ability to stage multiple images within a single wim file and let the single instancing technology of the format save you an awful lot of space. This can be important when you are trying to reduce the amount of duplicated space in an SCCM hierarchy.

I recently combined 6 legacy Windows XP thick images that were almost identical (differing HAL types & image architectures, for the most part) and managed to save 30GB of space on each site server in the environment. Combined with the space saved on Distribution points this accounts for near 420GB across the environment!

The procedure is remarkably easy, but first a couple of tips to help you get the most out of this technique :

Firstly, because the only way to shrink a wim file is to export all of the images out of it into a new file, take a copy of your WIMs before you start this process. If you combine two images (or even worse, the last of many..) and find that the resulting file is too large to realistically image from, you won’t want to go through the “shrink” procedure to undo the last image appended.

Try and combine images with the same OS Codebase into one wim. While there is nothing to stop you placing XP and Windows 7 images in the same wim, there will be significant differences between the two and you won’t achieve much of a space saving unless your images are quite thick.

Placing images that are around the same patch level will also help keep the wim file size low. A year’s worth of Software updates can have a remarkable effect on the size of an image!

If you store installation folders such as the i386 folder in your images, update the images so that they all have the same version.

Right, enough waffling, on with the guide!

1. Copy your wim files to a system with the Windows Automated Installation Kit installed and start the Deployment Tools Command prompt.
2. If you want to cleanup or update the images before combining them, use DISM to mount each wim and service it (using the below command). Otherwise, skip to step 3.

Once you’ve made your changes, run the below command to commit your changes and unmount your wim

DISM.exe /Unmount-Wim /MountDir:C:\test\offline /commit

3. Once you are ready to combine your images, pick one of your wim’s to be the base wim that the other images will be added to. If you carried out changes in Step 2, you will generally want to pick the wim that had the least modifications. This is because no data is actually ever removed from a wim file, only the metadata that associates the file with the image. When we run the export command any deleted data is not exported and effectively a “clean” wim is generated. As such you want to add heavily modified images to wims that have had very few / no changes, as this will keep your final wim’s size down to a minimum. So, once you have decided, rename your base wim to something descriptive (WinXPCombined.wim, for example) and then run the below command

The <ImageName> argument is a unique name for the image inside the wim file. If you want to modify the name of the image that already existed inside the wim, you can Use Imagex’s /info option to change it :

imagex /info d:\imaging\WinXPCombined.wim <imageindex> “New Name”

4. Once the export is finished, and you are happy with wim’s size, repeat the above step until all of your images are in the wim! You’ll note that the export function will only move data that isn’t already inside the wim, so the procedure can be extremely quick or rather lengthy..

Finally, I would recommend that you test your combined wim file and make sure that all of the images have been successfully exported and appended into the final wim before you delete your originals…