Windows Server 2012 Disk Cleanup utility

by Jacob, Updated on: December 10, 2020

This article introduces how to add, install, enable Disk Cleanup on Windows Server 2012 R2, and how to run Server 2012 Disk Cleanup (cleanmgr.exe) to free up disk space.

About Windows Server 2012 Disk Cleanup utility

The same with other versions, Windows Server 2012 system C: drive is getting full after running the server for a period of time. One of the solution is cleaning up disk space, delete unnecessary and junk files to reclaim disk space. To do this, Microsoft provides native Disk Cleanup utility, which can be run via cleanmgr command or with GUI wizard.

To free up disk space on Server 2012 (R2), Disk Cleanup is the first choice, because it is easy, fast and able to delete most common types of junk files safely. There are third party optimization programs, but the native Disk Cleanup utility is safer and powerful enough.

The same with Server 2008, Disk Cleanup in Windows Server 2012 is not activated by default, this is the reason why some people feedback that there is no disk cleanup in Server 2012, or receive error: Windows cannot find 'cleanmgr'. Make sure you typed the name correctly, and then try again.

How to install & enable Disk Cleanup in Windows Server 2012

There are two options to enable Disk Cleanup on Windows Server 2012 (R2): copy files from WinSxS and install with Desktop Experience feature.

It is easy and fast by copying files to specific folder, but in some environment Disk Cleanup doesn't work. By installing feature, Disk Cleanup is fully functional, but it requires reboot to complete installing. Furthermore, many other unnecessary components will be installed on the server together with Desktop Experience, such as:

This article introduces both methods with detailed steps, select the one that you like.

Add/Enable Disk Cleanup in Server 2012 without reboot

You just need to copy two files Cleanmgr.exe and Cleanmgr.exe.mui from WinSxS to system directory.

To Server 2012 R2, this copy method is invalid and you need to install. If you are not sure about your version, simply press Windows logo and R together on your keyboard to start Run, type winver and press Enter to check.

How to enable Disk Cleanup on Windows Server 2012 without rebooting:

Step 1: Press Windows and X together on the keyboard and select Command Prompt (Admin)

Step 2: Copy the command below, paste in the command prompt window and press Enter to execute.

copy C:\Windows\WinSxS\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.2.9200.16384_none_c60dddc5e750072a\cleanmgr.exe C:\Windows\System32\

Command 1

Step 3: Copy, paste and execute the second command:

copy C:\Windows\WinSxS\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.2.9200.16384_en-us_b6a01752226afbb3\cleanmgr.exe.mui C:\Windows\System32\en-US\    

Command 2

Install Disk Cleanup to Server 2012 with Desktop Experience

As I said above, you cannot enable Disk Cleanup in Windows Server 2012 R2 by simply coping files, you have to follow the steps below to install Disk Cleanup utility with Desktop Experience.

How to install Disk Cleanup in Windows Server 2012 R2:

Step 1: Click Server Manager on bottom left, and then click the 2nd option "Add roles and features".

Add feature

Step 2: Simply click Next in the following 4 windows.

Step 3: Click the triangle to unfold User Interface and Infrastructure, and then click the check-box in front of "Desktop Experience".

Desktop Experience

It'll pop up a window and ask you to add additional features, click Add Features on bottom.

Add features

Step 4: Click the check-box in front of "Desktop Experience" again, and then click Next. Then click Install in next window.

Select feature

Step 5: Click Close when it finish, it requires reboot to complete installation and take effect.


How to run Disk Cleanup in Windows Server 2012 and R2

There are two ways to open Disk Cleanup on Windows Server 2012 (R2).

Option 1: run cleanmgr (valid after copying files or installing)

  1. Press Windows and R on your keyboard, type cleanmgr and press Enter.
  2. Select C: (or other) drive in the drop-down list and click OK.

Select drive

Option 2: via File Explorer (only valid after installing)

  1. Open File Explorer, right click C drive and select Properties.
  2. Click Disk Cleanup button in this middle.

No matter which way, it is very easy to free up disk space with Disk Cleanup in Windows Server 2012 (R2), simply click the check-box in front of the files that you want to delete and then click OK to execute.

Disk Cleanup

My test server is new installed, so I can reclaim little space. To the servers that never or have not free up disk space for a long time, Server 2012 Disk Cleanup utility may helps you regain over 10GB disk space.

If you get only little space with Disk Cleanup on Windows 2012 Server, or the system C drive is created small, you'd better expand C drive to larger size. Otherwise, C drive will be full again shortly. In fact, even if you get 10GB free space, it will be eaten up quickly by new generated junk files.

With server partition software, you can shrink any data volumes to get Unallocated space and add into C drive. Operating System, programs and anything else keep the same with before.

Download NIUBI Partition Editor and follow the steps in the video to add more free space to C drive.

Video guide

Besides shrinking and extending partitions without losing data, NIUBI Partition Editor helps do many other disk and partition management operations.