How to enable/install Disk Cleanup in Windows Server 2012 (R2)?
What is Disk Cleanup
Disk Cleanup (cleanmgr.exe) is a computer maintenance utility first introduced with Windows 98 and included in all subsequent releases of Windows. It is designed to free up disk space by removing files that are no longer needed or that can be safely deleted.
There are a number of different file categories that Disk Cleanup targets when performing the initial disk analysis:
- Compression of old files
- Temporary Internet files
- Temporary Windows files
- Downloaded program files
- Recycle Bin
- Removal of unused applications or optional Windows components
- Setup log files
- Offline web pages (cached)
the above list, however, is not exhaustive.
No Disk Cleanup in Windows Server 2012
Windows Disk Cleanup is very useful utility and I’ve used it to free up disk space from Server 2003. It helps delete many kinds of unused files safely and easily. However, when you right-click C drive on Windows Server 2012, you won’t see Disk Cleanup button.
If you try to start from Run, you’ll receive the error: Windows cannot find ‘cleanmgr’. Make sure you typed the name correctly, and then try again.
For some reason Microsoft decided to leave Disk Cleanup disabled on Windows Server 2012 by default, and you have to enable it manually.
Enable Disk Cleanup in Windows Server 2012
There are two ways to enable Disk Cleanup tool:
- Copy files from WinSxS
- Install Desktop Experience
The first option is easy and fast, but in some environment Disk Cleanup won’t work. The second option make sure Disk Cleanup work in most conditions, but it requires reboot to complete installing the Desktop Experience feature. Furthermore, together with Desktop Experience, many other unnecessary components are installed on the server, such as:
- Windows Media Player
- Desktop themes
- AVI support for Windows
- Windows SideShow
- Windows Defender
- Sync Center
- Audio recording
- Character Map
- Snipping Tool
Enable disk cleanup without reboot
Note: This method is not valid for Server 2012 R2.
All you really need to do is copy two files Cleanmgr.exe and Cleanmgr.exe.mui from WinSxS to system directory, steps:
1. Locate files:
2. Move files:
- Copy Cleanmgr.exe to %systemroot%\System32
- Copy Cleanmgr.exe.mui to %systemroot%\System32\en-US
You can now launch the Disk cleanup tool by running Cleanmgr.exe from the command prompt.
Install disk cleanup with desktop experience
Step 1: Click Server Manager on bottom left, click the 2nd option “Add roles and features“.
Step 2: Click Next till you see the Features.
Step 3: Click the check-box in front of “Desktop Experience” and click Next.
Step 4: Within several minutes, the installation complete, click Close.
Step 5: Restart the server to finish adding features.
After booting to desktop, when you right click C drive in Explorer, you’ll see Disk Cleanup.
Install Disk Cleanup in Windows Server 2012 R2
As I said above, you cannot enable Disk Cleanup in Server 2012 R2 by simply coping files, you have to follow the steps above to install Desktop Experience.
Supplement of Disk Cleanup
Disk Cleanup is good tool to free up disk space, but in some condition you cannot reclaim large amount of free space. In this case, you may consider taking some free space out from other drives and add the free space to C drive, steps:
Step 1: Download NIUBI Partition Editor, right click D: drive and select “Resize/Move Volume“.
Step 2: In the pop-up window, drag the left border rightwards to generate free Unallocated space.
You may also input a value for the Unallocated space directly.
Click OK and back to the main window, where you’ll see 20GB Unallocated space created behind C: drive.
Step 3: Drag the right border rightwards to hold the Unallocated space.
Step 4: Click OK and back to the main window, where you’ll see C drive extended to 60GB by robbing 20GB free space from D. Press Apply on top left to execute, done!
NIUBI Partition Editor integrated unique Roll-Back protection technology, which is able to roll back the server to the status before reszing automatically and rapidly if power failure or any other hardware issue occur, so you don’t need to worry about Operating System and all data safety. Furthermore, it is 30% – 300% faster than ANY other tools, because of its unique file-moving algorithm.