If you’ve had Windows Server running for a while, you may be running out of disk space – particularly on a VM. This article explains how to enable the ‘Disk Cleanup’ utility on Windows Server 2008, 2008 R2, 2012, and 2012 R2 – without enabling Desktop Experience – to recover lots of space from C:\Windows\WinSxS.

Disk Cleanup is a free tool provided from Microsoft, but not bundled by default in the Windows Server editions of Windows. Typically, you need to enable the ‘Desktop Experience’ feature to get this simple utility – unfortunately adding unnecessary utilities such as Windows Media Player in the process. This isn’t ideal, and may not even work if you’ve already run out of disk space.

There are two files you need to copy into the correct locations to enable this utility:

  • cleanmgr.exe
  • cleanmgr.exe.mui

These files come bundles with Windows in a secret location, so you simply need to copy them into the folder where they belong.

Once you’ve copied them both, just search for and run ‘cleanmgr’. You’ll need to be an administrator to run it.

cleanmgr.exe

Use the list below to find the location of cleanmgr.exe, and then copy it to C:\Windows\System32\

Windows Server 2012
C:\Windows\WinSxS\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.2.9200.16384_none_c60dddc5e750072a\cleanmgr.exe

Windows Server 2008 R2
C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.1.7600.16385_none_c9392808773cd7da\cleanmgr.exe

Windows Server 2008
C:\Windows\winsxs\x86_microsoft-windows-cleanmgr_31bf3856ad364e35_6.0.6001.18000_none_6d4436615d8bd133\cleanmgr.exe

cleanmgr.exe.mui

Use the list below to find the location of cleanmgr.exe.mui, and then copy it to C:\Windows\System32\en-US\

Windows Server 2012
C:\Windows\WinSxS\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.2.9200.16384_en-us_b6a01752226afbb3\cleanmgr.exe.mui

Windows Server 2008 R2
C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.0.6001.18000_en-us_b9f50b71510436f2\cleanmgr.exe.mui

Windows Server 2008
C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.1.7600.16385_en-us_b9cb6194b257cc63\cleanmgr.exe.mui

Windows Server 2012 R2

Microsoft has changed the method used to save Windows Updates, meaning they should take up less space on the disk. However, if you still want to install Disk Cleanup, you need to follow this process:

  1. Install ‘Desktop Experience’ feature via Server Manager
  2. Copy C:\Windows\System32\cleanmgr.exe and C:\Windows\System32\en-US\cleanmgr.exe.mui to a separate (non-system) folder
  3. Uninstall ‘Desktop Experience’ feature via Server Manager
  4. Copy cleanmgr.exe back to C:\Windows\System32, and cleamgr.exe.mui to C:\Windows\System32\en-US\

Why does C:\Windows\WinSxS get so big?

This folder is the Side-by-Side software folder, which stores a lot of components used within Windows. If you run a utility such as TreeSize, you may notice this folder is very big. This is partially because many files here also show up in separate parts of the filesystem – not duplicates, but just references.

Cleanup WinSxS with DISM

You may also like to cleanup the WinSxS folder via DISM – another free tool provided with Windows, which can perform a similar task to the Disk Cleanup utility.

This free tool runs on the command line. You must run the Command Line as an Administrator (right click on the icon before running it and select ‘Run as Administrator’).

This command will show you if Windows thinks it can save some space:
Dism.exe /online /Cleanup-Image /StartComponentCleanup

And this command will tell actually perform the cleanup:
Dism.exe /online /Cleanup-Image /StartComponentCleanup

Get the Broadcast Technology Newsletter

Sign up for the email newsletter about media and technology. Sent irregularly. No spam.

I'm Anthony Eden, and I'm a IT Professional, Broadcast Technician, Software Developer, and Solutions Engineer. I've been working in broadcast media since 2008, and developing software and websites for just as long. Right now, I provide freelance services through Media Realm - in particular, to the media and not-for-profit industries.

Follow Anthony on Twitter: @anthony_eden