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 utility - Disk Cleanup, 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, this utility is not installed by default, this is the reason why some people feedback that there is no disk cleanup in Server 2012, or report error: Windows cannot find 'cleanmgr'. Make sure you typed the name correctly, and then try again.
How to install & enable Disk Cleanup on Server 2012
There are two options to add Disk Cleanup on Windows Server 2012 (R2): enable by copying files from WinSxS or 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:
- Windows Media Player
- Desktop themes
- AVI support for Windows
- Windows SideShow
- Windows Defender
- Sync Center
- Audio recording
- Character Map
- Snipping Tool
This article introduces both methods with detailed steps, select the one that you like.
How to add, enable Disk Cleanup 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.
Steps 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\
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\
How to install Disk Cleanup 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.
Steps to install Disk Cleanup to Windows Server 2012:
Step 1: Click Server Manager on bottom left, and then click the 2nd option "Add roles and features".
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".
Step 4: Click the check-box in front of "Desktop Experience" again, and then click Next. Then click Install in next window.
Step 5: Click Close when it finish, it requires reboot to complete installation and take effect.
How to run Disk Cleanup on Windows Server 2012
There are two ways to launch Disk Cleanup on Windows Server 2012 (R2).
Option 1: run cleanmgr (valid after copying files or installing)
- Press Windows and R on your keyboard, type cleanmgr and press Enter.
- Select C: (or other) drive in the drop-down list and click OK.
Option 2: via File Explorer (only valid after installing)
- Open File Explorer, right click C drive and select Properties.
- Click Disk Cleanup button in this middle.
No matter which way, it is very easy to free up disk space with Disk Cleanup on 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.
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.
Download NIUBI Partition Editor and follow the steps in the video to expand system C drive.
Besides shrinking and extending partitions without losing data, NIUBI Partition Editor helps do many other disk and partition operations.