Shrink your Windows 8.1/Server 2012 Images

I recently needed to re-capture a Windows 8.1 Reference Image to include the latest security patches and noticed the size of the reference WIM was beginning to creep up. This reminded me of a DISM command which I had read about but never actually got around to testing.

Anyway…I finally got the chance to test it and I must admit the results were pretty good. So here’s how you shrink your reference images:

Some background…
The DISM tool now contains a bunch of new servicing commands related to the component store (or the WINSxs directory). Most importantly for OS deployment guys a couple of these commands can be leveraged to reduce the size of patched Win 8.1 and Server 2012 R2 images.

What do you need to do?
Before you run a capture of your reference machine run the following command (whilst in Windows):

DISM /Online /Cleanup-Image /StartComponentCleanup /ResetBase

The command only takes a few minutes to complete and once complete you can capture your reference image as per usual process.

What are the results like?
I began by running a basic Build and Capture Task Sequence for a Windows 8.1 x64 Enterprise build (including the latest security patches). The captured reference WIM was around 3.76GB.

I then updated my Build and Capture Task Sequence with an additional step to clean-up the component store:

Task Sequence

Note: The location of the additional step is after the patches are applied and before image capture. No reboot is required after running the command.

I then re-ran the Task Sequence and the captured image was now down to 3.2GB:

Windows Explorer

Over 500MB saved…that’s a pretty big deal 🙂

Some caveats to consider:
The command only works on Windows 8.1 and Server 2012 R2.

After running DISM with the “/ResetBase” parameter you cannot go back and uninstall previously installed updates…so make sure you test that new image before deploying!

Before running the command I can Uninstall.

Before running the command I can see 27 updates are listed and I can uninstall updates.

After running DISM with the "/ResetBase" parameter - 25 Updates listed and No Uninstall button.

After running DISM with the “/ResetBase” parameter only 25 updates listed and there is NO Uninstall button.

If you prefer you can drop the “/ResetBase” parameter but the results will not be quite as good.

A bit more info:
If you are interested you can also run the following command to check the status of the Component Store:

DISM /Online /Cleanup-Image /AnalyzeComponentStore

The following screenshot shows the state of the Component Store before and after the Clean-up:
AnalyzeComponentStoreI hope the post was useful… Comments welcome 🙂

Surjit Khera


3 thoughts on “Shrink your Windows 8.1/Server 2012 Images

  1. Pingback: Interm I T Essex | Shrink your Windows 8.1/Server 2012 Images

Speak your mind...

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s