Using Disk Cleanup on Windows Server
Applies to: Windows Server 2019, Windows Server 2016, Windows Server 2012 R2, Windows Server 2012, Windows Server 2008 R2
The Disk Cleanup tool clears unnecessary files in a Windows Server environment. This tool is available by default on Windows Server 2019 and Windows Server 2016, but you might have to take a few manual steps to enable it on earlier versions of Windows Server.
To start the Disk Cleanup tool, either run the Cleanmgr.exe command, or select Start, select Windows Administrative Tools, and then select Disk Cleanup.
You can also run Disk Cleanup by using the cleanmgr Windows command and use command-line options to specify that Disk Cleanup cleans up certain files.
Enable Disk Cleanup on an earlier version of Windows Server by installing the Desktop Experience
Follow these steps to use the Add Roles and Features Wizard to install the Desktop Experience on a server running Windows Server 2012 R2 or earlier, which also installs Disk Cleanup.
If Server Manager is already open, go on to the next step. If Server Manager is not already open, open it by doing one of the following.
On the Windows desktop, start Server Manager by clicking Server Manager in the Windows taskbar.
Go to Start and select the Server Manager tile.
On the Manage menu, select add Roles and Features.
On the Before you begin page, verify that your destination server and network environment are prepared for the feature that you want to install. Select Next.
On the Select installation type page, select Role-based or feature-based installation to install all parts features on a single server. Select Next.
On the Select destination server page, select a server from the server pool, or select an offline VHD. Select Next.
On the Select server roles page, select Next.
On the Select features page, select User Interface and Infrastructure, and then select Desktop Experience.
In Add features that are required for Desktop Experience?, select Add Features.
Proceed with the installation, and then reboot the system.
Verify that the Disk Cleanup option button appears in the Properties dialog box.
Manually add Disk Cleanup to an earlier version of Windows Server
The Disk Cleanup tool (cleanmgr.exe) isn't present on Windows Server 2012 R2 or earlier unless you have the Desktop Experience feature installed.
To use cleanmgr.exe, install the Desktop Experience as described earlier, or copy two files that are already present on the server, cleanmgr.exe and cleanmgr.exe.mui. Use the following table to locate the files for your operating system.
|Operating System||Architecture||File Location|
|Windows Server 2008 R2||64-bit||C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.1.7600.16385_none_c9392808773cd7da\cleanmgr.exe|
|Windows Server 2008 R2||64-bit||C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.1.7600.16385_en-us_b9cb6194b257cc63\cleanmgr.exe.mui|
Locate cleanmgr.exe and move the file to %systemroot%\System32.
Locate cleanmgr.exe.mui and move the files to %systemroot%\System32\en-US.
You can now launch the Disk cleanup tool by running Cleanmgr.exe from Command Prompt, or by clicking Start and typing Cleanmgr into the search bar.
To have Disk Cleanup button appear on a disk's Properties dialog, you will also need to install the Desktop Experience feature.