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.

Disk Cleanup 2012

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.

No Disk cleanup

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.

Cleanup error

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:

  1. Copy files from WinSxS
  2. 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:

  • C:\Windows\WinSxS\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.2.9200.16384_none_c60dddc5e750072a\cleanmgr.exe
  • C:\Windows\WinSxS\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.2.9200.16384_en-us_b6a01752226afbb3\cleanmgr.exe.mui

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“.

server manager

Step 2: Click Next till you see the Features.

Add roles

Step 3: Click the check-box in front of “Desktop Experience” and click Next.

Select to install

Step 4: Within several minutes, the installation complete, click Close.

Install complete

Step 5: Restart the server to finish adding features.

Rebooting

After booting to desktop, when you right click C drive in Explorer, you’ll see Disk Cleanup.

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”.

Reallocate 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.

Set value

3: Press Apply button on main window to proceed, done.

C drive expand

Operating System and all data keep the same after repartitioning. 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. See detailed info.

Comments are closed.