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:WindowsWinSxS.
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:WindowsSystem32
Windows Server 2012
C:WindowsWinSxSamd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.2.9200.16384_none_c60dddc5e750072acleanmgr.exe
Windows Server 2008 R2
C:Windowswinsxsamd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.1.7600.16385_none_c9392808773cd7dacleanmgr.exe
Windows Server 2008
C:Windowswinsxsx86_microsoft-windows-cleanmgr_31bf3856ad364e35_6.0.6001.18000_none_6d4436615d8bd133cleanmgr.exe
cleanmgr.exe.mui
Use the list below to find the location of cleanmgr.exe.mui, and then copy it to C:WindowsSystem32en-US
Windows Server 2012
C:WindowsWinSxSamd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.2.9200.16384_en-us_b6a01752226afbb3cleanmgr.exe.mui
Windows Server 2008 R2
C:Windowswinsxsamd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.0.6001.18000_en-us_b9f50b71510436f2cleanmgr.exe.mui
Windows Server 2008
C:Windowswinsxsamd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.1.7600.16385_en-us_b9cb6194b257cc63cleanmgr.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:
- Install ‘Desktop Experience’ feature via Server Manager
- Copy C:WindowsSystem32cleanmgr.exe and C:WindowsSystem32en-UScleanmgr.exe.mui to a separate (non-system) folder
- Uninstall ‘Desktop Experience’ feature via Server Manager
- Copy cleanmgr.exe back to C:WindowsSystem32, and cleamgr.exe.mui to C:WindowsSystem32en-US
Why does C:WindowsWinSxS 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