How to Run Disk Cleanup in Windows Server 2019/2022

by John, Updated on: August 21, 2024

C drive full is common issue in Windows Server 2019 and 2022. When it happens, firstly you'd better clean up C drive to reclaim disk space. To clean up C drive in Windows Server 2019/2022, there's a native "Disk Cleanup" utility. It is easy to use, runs fast and able to remove most of junk and unnecessary files safely. If you cannot reclaim plenty of disk space, you'd better move free space from other partition on the disk. Otherwise, C drive will become full again in a short time. In this article I'll introduce how to run Disk Cleanup in Windows Server 2019/2022 with wizard, and how to clean up C drive in Server 2019/2022 with  cleanmgr command automatically.

How to run Disk Cleanup in Windows Server 2019/2022 with wizard

Step 1: Press Windows + E on the keyboard to open File Explorer, right click C drive and click Properties.

Properties

Step 2: Click Disk Cleanup in the pop-up window.

Disk Cleanup

Step 3: Click the check-boxes in front of the files that you want to delete, then click OK and confirm.

Select files

Step 4: Switch to More Options tab to clean up system restore point and shadow copies.

More options

If you like to use command line tool, you can clean up C drive in Windows Server 2019/2022 with cleanmgr command.

How to run Disk Cleanup in Server 2019/2022 with cleanmgr command

There are several ways to clean up disk in Windows Server 2019/2022 via cleanmgr command, select the one that fit for your needs.

Way 1: Select files and confirm manually

  1. Press Windows and R together on the keyboard.
  2. Type cleanmgr and press Enter.
  3. Select C: drive (or other one) in the drop-down box and click OK.
  4. Disk Cleanup dialog box will pop up, the next steps are the same with above (from step 2).

Way 2: Select all files automatically but confirm manually

  1. Press Windows + R together to open Run.
  2. Type 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.

Way 3: Clean up all junk files automatically

  1. Press Windows and R together on the keyboard.
  2. Type 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 result

Way 4: Clean up specified junk files automatically

  1. Press Windows and R together on the keyboard to open Run.
  2. Type 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. Press Windows and R together on the keyboard, type cleanmgr /sageset:1 and press Enter. Then the preselected junk files will be deleted without a result window.

In the future, you just need to run cleanmgr /sageset:1. If you want to delete other types of files, Type cleanmgr /sageset:2 in step 2 and run cleanmgr /sageset:2 in step 4.

Additional step after clearing up disk

No matter you clean up disk in Windows Server 2019/2022 with GUI wizard or via command, there's no difference to the result. In general, you'll reclaim some disk space but you can't get over 20GB free space in most cases. As I said in the beginning, you'd better move free space to C drive from other partitions.

Download NIUBI Partition Editor and follow the steps in the video:

Video Server 2019

Free space will be transferred to C drive without losing data, Operating System, programs and associated settings, as well as anything else keep the same with before. Besides shrinking and extending disk partitions, NIUBI Partition Editor helps do many other disk partition operations such as clone, merge, move, convert, defrag, hide, wipe, set read-only attribute, scan bad sectors, etc.

Note: You'd better run Disk cleanup in Server 2019/2022 once a month to remove new generated junk files. In addition, change default output path of programs to other large partition.