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:

Step 1: Download NIUBI Partition Editor, right click D: drive and select “Resize/Move Volume“.

Drag to resize

Step 2: In the pop-up window, drag the left border rightwards to generate free Unallocated space.

Shrink volume

You may also input a value for the Unallocated space directly.

Drag to resize

Click OK and back to the main window, where you’ll see 20GB Unallocated space created behind C: drive.

Unallocated space

Step 3: Drag the right border rightwards to hold the Unallocated space.

Drag to resize

Hold 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!

Partition resized

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.

Learn More Download to try

Leave a Reply

You must be logged in to post a comment.