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


Windows 8.1 and Windows Server 2012 R2 KMS Keys

I’ve had to go look for this information twice this month, both times struggling to remember how I found the information, so it seems only right to blog the answer as well as the link for both myself and anyone who is searching for it.
The below table lists all the KMS installation keys for Windows 8.1 and Windows Server 2012 R2.  You can use these keys to complete an installation of Windows and also to activate an already installed instance.

Operating system edition KMS Client Setup Key
Windows 8.1 Professional GCRJD-8NW9H-F2CDX-CCM8D-9D6T9
Windows 8.1 Professional N HMCNV-VVBFX-7HMBH-CTY9B-B4FXY
Windows 8.1 Enterprise MHF9N-XY6XB-WVXMC-BTDCT-MKKG7
Windows 8.1 Enterprise N TT4HM-HN7YT-62K67-RGRQJ-JFFXW
Windows Server 2012 R2 Server Standard D2N9P-3P6X9-2R39C-7RTCD-MDVJX
Windows Server 2012 R2 Datacenter W3GGN-FT8W3-Y4M27-J84CP-Q3VJ9
Windows Server 2012 R2 Essentials KNC87-3J2TX-XB4WP-VCPJV-M4FWM

In the source link below you can find the KMS keys for the following operating systems:

  • Windows Server 2012 R2 and Windows 8.1 Client Setup Keys
  • Windows Server 2012 and Windows 8 Client Setup Keys
  • Windows 7 and Windows Server 2008 R2
  • Windows Vista and Windows Server 2008