Share via


Why is DISM Growing My WIM When Running StartComponentCleanup?

Have you ever tried to clean up a wim with the /startcomponentcleanup parameter only to have it grow the wim instead of shrink it?  If you have and you are not sure why it didn't work then I can help you out.

I was trying to shrink a Sysprep'd offline Windows Server 2012 R2 WIM and when I ran the command DISM /image:<path to image> /cleanup-image /analyzecomponentstore it recommended running the /StartComponentCleanup.  

So I ran the command DISM /image:<path to image> /Cleanup-Image /StartComponentCleanup /ResetBase.

After running the DISM command the WIM grew from ~8GB to ~10GB.  That puzzled me because it was suppose to shrink the image.

So I started over and deployed the image again.  This time I did not sysprep the image and instead ran DISM /online /Cleanup-Image /StartComponentCleanup /ResetBase from the active OS I want to skrink.  After the command completed I did notice that the used space on the system root drive (C:) went down.

I then rebooted the system into a Windows PE environment and captured the WIM.  It went from being a ~8GB image before to now ~5GB.

So lesson to learn here is DISM will not shrink an offline sysprep'd image.

I do want to try to perform the DISM Component Store cleanup on an offline image that is not sysprep'd to see if it shrinks or grows it (I'm hoping it will shrink and will update this blog after I do it).