How to Enable/Run Disk Cleanup in Windows Server 2012 R2

by Jacob, Updated on: June 28, 2022

C drive low disk space is common issue in Windows Server 2012 and R2. To solve this problem, firstly you'd better free up disk space. To accomplish this task, Windows Server 2012 has native Disk Cleanup tool. But different with other version, this tool is not enabled by default. This is the reason why many people feedback that Disk Cleanup is missing in Windows Server 2012 (r2). In this article I'll introduce how to add, install, enable Disk Cleanup in 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 C drive, 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 clean up C drive in Server 2012 (R2), the native Disk Cleanup utility 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 cleanup utility is safe and powerful enough. There's no need to fight for 1GB more free space but put server in danger.

As I said in the beginning, Disk Cleanup in Server 2012 (R2) is not activated by default. This is the reason why some people feedback that Disk Cleanup is missing in Server 2012 (R2), or receive error: Windows cannot find 'cleanmgr'. Make sure you typed the name correctly, and then try again.

Before cleaning up disk space on C drive in Windows Server 2012 (R2), you must install or enable this utility by yourself.

How to install/enable Disk Cleanup in Windows Server 2012 R2

There are two options to enable Disk Cleanup in 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 Desktop Experience 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:

I'll introduce both methods to enable Disk Cleanup in Windows Server 2012 (R2) one by one, select the one that fits for your needs.

1. 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 Desktop Experience. If you are not sure about your version, simply press Windows + R together on your keyboard to start Run, type winver and press Enter to check.

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

Step 1: Press Windows + 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

2. Install Disk Cleanup to Server 2012 (R2) with Desktop Experience

As I said above, you cannot enable Disk Cleanup in Windows Server 2012 R2 by simply copying 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.

Complete

How to run Disk Cleanup in Windows Server 2012 and R2

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

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

  1. Press Windows + 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 several GBs of disk space.

How to clean up disk in Windows Server 2012 (R2) with cleanmgr command

There are 3 ways to run cleanmgr command in Server 2012 (R2), select the one that fit for your needs.

All junk files are selected and confirm by yourself

  1. Press Windows and R together on the keyboard.
  2. Input cleanmgr /LOWDISK and press Enter.
  3. Disk Cleanup dialog box will pop up with all types of files selected by default, so you just need to click OK to confirm.

Clean up all junk files automatically

  1. Press Windows and R together on the keyboard.
  2. Input cleanmgr /VERYLOWDISK and press Enter.

Then Disk Cleanup will delete all junk files automatically and then show you a dialog box with result.

Clean up specified junk files automatically

  1. Press Windows and R together on the keyboard to open Run.
  2. Input cleanmgr /sageset:1 and press Enter. (You can specify the value from 0 to 65535).
  3. Disk Cleanup dialog box will pop up, select the files to delete and click OK.
  4. In the future, you just need to run cleanmgr /sageset:1 and press Enter, the preselected junk files will be deleted automatically. If you want to delete different types of files, input cleanmgr /sageset:2 in step 2 and run cleanmgr /sageset:2 in step 4.

If you get only little space with Disk Cleanup in 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 volume on the same disk to get Unallocated space and then add into C drive. In this way, there will be more free space in C drive. Operating System, programs and anything else keep the same with before. This step is most important to help solve this problem.

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.