The Deployment Guys

Helping to deploy your world automagically...

Non-shrinking WIM files

Non-shrinking WIM files

  • Comments 8
  • Likes

If you make regular changes to your WIM files with the use of the /MOUNTRW or /DELETE switches of IMAGEX, then you may have noticed that your WIM files do not shrink in size after you commit the changes back to the file.  You could delete 500mb of data from an image file, only to see the file stay the same size, or even grow by a few megabytes.  The reason for this is that the data in a WIM file are not actually removed from the file when deleted, rather the references to it's contents are simply removed; this is a bit like how deleting a file from your C: drive only deletes the reference to it in the allocation table rather than actually scrubbing all the files binary 1's and 0's from the disk sectors.

But don't worry, there is a solution to this which you can use to optimise the size of your WIM files!  With the use of the /EXPORT switch of IMAGEX, you simply export the image from the WIM file into a new one, and you can even change the level of compression used.  An example of the use of the command is:

ImageX.exe /export existing.wim X new.wim "My optimised WIM file"    (where X is the number of the image file you want to export)

If you make regular manual edits to your existing WIM files then you might want to consider including the process of exporting the WIM to a new one into your work routine.  However, it is probably not worth using export if you make infrequent or one off changes.  One important thing to remember when using the export command is not to lose any of the /FLAGS settings during your export!

The question that clients always ask me about this subject is: why has Microsoft designed IMAGEX like this?  The answer is logical, if not always obvious though at first glance.  So, why does IMAGEX not optimise the file upon every commit action?  Well, for a start, it would be very inefficient to have to do this each time you change the WIM file.  Imagine that you add a 10kb file to a 12Gb WIM, then commit the changes.  You'd have to wait while IMAGEX streams the 12Gb of data into a new WIM file, which would take a very long time.


Finally, I would not consider it good practice manually editing your WIM files on a regular basis.  It would be better to use MDT to include any changes you need to make by incorporating them in future versions of your image files.  Infrequent manual changes are fine, but if you are regularly having to manually edit your WIM files in order to include new files/registry keys etc. then you should be looking at automating this process in order to reduce this required manual administration.  It will make work easier!


This post was contributed by Daniel Oxley a consultant with Microsoft Services Spain

  • Daniel,

    This works fine for WIM's themselves, but one of the problems I am having is when I make the WIM into a bootable ISO (say for a PE disc) and each time i make a change and make a new ISO, the ISO itself grows by ~100mb each time.

    Is there any way to avoid this?

  • Daniel Oxley shows a way to shrink your WIM files:

  • Daniel Oxley shows a way to shrink your WIM files:

  • Jordan,

    What software are you using to create the ISO files?  I have seen this with UltraISO and I always used the option "Optimise file" when you are saving the file to avoid this.



  • 183 Microsoft Team blogs searched, 87 blogs have new articles in the past 7 days. 205 new articles found

  • 183 Microsoft Team blogs searched, 87 blogs have new articles in the past 7 days. 205 new articles found

  • I use microsofts OSCDIMG that comes with the WAIK.

  • Thanks for posting this, exactly what I needed to shrink my constantly modified WIM files

    all the best


Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment