I recently helped out someone who was running extremely low on disk space on their system drive, due to a bloated Windows\winsxs directory. This directory is where Windows keeps backup files for various things such as Windows Server 2008 R2 Service Pack 1. These files allow you to uninstall Service Pack 1, in case you ever actually wanted to do that.

The system in question was using about 15.5GB of disk space in that directory. After a bit of research, I discovered the DISM.exe command. When you install Windows Server 2008 R2 SP1, the setup program backs up any files that are replaced by the service pack. You can remove these backup files to save space with the Deployment Image Servicing and Management (DISM) tool. If you do this, you will not be able to uninstall Service Pack 1 any longer, but you will get back a decent amount of disk space (typically, anywhere from around 2 to 7 GB).

You need to open a command prompt with elevated privileges (by right-clicking and selecting “Run as Administrator”). Once you have a command prompt open, simply type this command (shown in Figure 1):

DISM.exe /online /Cleanup-Image /spsuperseded

Microsoft has a Deployment Guide for Windows Server 2008 R2 with SP1 and Windows 7 with SP1, where you can get more background on this.

Depending on the speed of your disk subsystem and the components you have installed, it may take around five to ten minutes for the command to complete. Once it is done, you should have some more free space available on your system drive. After running this command (which you can only do once), I would also manually defragment the system drive.

This command will only work if you have Windows Server 2008 R2 Service Pack 1 (or Windows 7 Service Pack 1) installed. If you are running Windows Server 2008 R2 or Windows 7, you really should have Service Pack 1 installed by now. Microsoft has actually started pushing Service Pack 1 down to Windows 7 systems as an Important Update, using Windows Update on March 19, 2013.

 

image thumb How to Reclaim Disk Space in your Windows\winsxs directory on Windows Server 2008 R2 SP1

Figure 1: Command Prompt Window with DISM.EXE Command Switches

 

image thumb1 How to Reclaim Disk Space in your Windows\winsxs directory on Windows Server 2008 R2 SP1

Figure 2: Command Prompt Window After Running DISM.EXE