

Below you can see commands to copy cleanmgr files in different Windows versions (in all cases, the path is used for Windows Server English language editions). To run the Disk Cleanup on Windows Server, you can use a simple method: just copy two files Cleanmgr.exe and from WinSxS to the system32 directory. Together with Desktop Experience, many other unnecessary components are installed on the server: To use the cleanmgr utility, first you have to install a separate server Desktop Experience feature using either Server Manager or PowerShell ( Install-WindowsFeature Desktop-Experience). Start-Process -FilePath CleanMgr.exe -ArgumentList '/sagerun:11' -WindowStyle Hidden -Wait How to Enable Disk Cleanup on Windows Server 2012 R2/2008 R2 without Installing Desktop Experience?īy default, in Windows Server 2012/R/R2 the Disk Cleanup ( cleanmgr.exe) tool is not installed by default. To automatically cleanup the system drive on workstations with Windows 10, you can create a simple scheduled task with the following PowerShell code: If you need to configure automatic disk cleanup task on computers (or servers) in an Active Directory domain, you just need to export this registry key and deploy it on computers through the GPO. To start the drive cleanup task with the selected parameters, run the command:

For each option you select, a DWORD parameter is created with the name StateFlags0011 ( 0011 is the number you specified in the sageset parameter).

This registry section lists all the Windows components that can be cleaned using the Disk Cleanup tool. These settings are saved to the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches. In the window that opens, select the components and files that you want to automatically cleanup (I selected all the options). Using the /sageset:xx and /sagerun:xx options, you can create and run a customized set of cleanup options.įor example, run the command: cleanmgr /sageset: 11. Your C:\ volume now has 10000 Mb of free space remaining. You have successfully resolved the low disk space condition. The cleanmgr /VERYLOWDISK command performs automatic drive cleanup (without showing GUI), and after the end it displays information about the actions performed and available free space. The cleanmgr /LOWDISK command runs the Disk Cleanup GUI with the already selected cleaning options.
