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:
1: Download partition assistant, right click any drive that has plenty of free space, select “Allocate Free Space”.
2: In the pop-up window, type the amount of free space to get from drive E, and select C drive in drop-down box.
3: Press Apply button on main window to proceed, done.
Video guide to increase C drive free space in Windows Server 2012
(Recommend full screen by clicking the square at bottom right of this video)
Operating System and all data keep the same after resizing partitions. This application is compatible with all kinds of hardware RAID, such as RAID 0/1/5/10, VMware/Hyper-V, HDD, SSD and USB disk are all supported.