Coming Soon: GET:IT Endpoint Management 1-Day Conference on September 28th at 9:30 AM ET Coming Soon: GET:IT Endpoint Management 1-Day Conference on September 28th at 9:30 AM ET
Windows 10

A Tip to Free Disk Space in Windows 10

Windows 10 Hero Good

Running out of disk space isn’t a new problem to IT pros. Since the introduction of Windows XP, Microsoft’s Disk Cleanup utility helps users free disk space that’s eaten up by system settings, temporary files, and more. The tool can be used both manually or automated by using the command line and Windows Task Scheduler.

Running Microsoft’s Disk Cleanup Utility

To manually run the Disk Cleanup utility, do one of the following:

1. Open Windows Explorer, right click on the C:\ drive, and select Properties.

Sponsored Content

Say Goodbye to Traditional PC Lifecycle Management

Traditional IT tools, including Microsoft SCCM, Ghost Solution Suite, and KACE, often require considerable custom configurations by T3 technicians (an expensive and often elusive IT resource) to enable management of a hybrid onsite + remote workforce. In many cases, even with the best resources, organizations are finding that these on-premise tools simply cannot support remote endpoints consistently and reliably due to infrastructure limitations.

automating-disk-cleanup-2

2. In the Properties window, click “Disk Cleanup.”

Selecting the Disk Cleanup utility. (Image Credit: Daniel Petri)
Selecting the Disk Cleanup utility. (Image Credit: Daniel Petri)

Or:

1. Click on Start and type “disk” with no quotes. The first result should be “Disk Cleanup.” Click Enter.

Running Disk Cleanup from the Start menu in Windows 10. (Image Credit: Daniel Petri)
Running Disk Cleanup from the Start menu in Windows 10. (Image Credit: Daniel Petri)

Or:

1. Open Command Prompt with administrative permissions.

2. Type the following line, and press Enter:

Cleanmgr.exe

Opening Disk Cleanup through the command prompt. (Image Credit: Daniel Petri)
Opening Disk Cleanup through the command prompt. (Image Credit: Daniel Petri)

If your computer has more than one drive, then you will be prompted to select the drive to inspect. The System drive, typically C:\, is the default.

Once the tool starts, the first thing we see is the size calculation window, which might take a few seconds to complete.

Disk Cleanup is calculating how much time it takes to run. (Image Credit: Daniel Petri)
Disk Cleanup is calculating how much time it takes to run. (Image Credit: Daniel Petri)

Disk Cleanup Options in Windows 10

Disk Cleanup utility can be used to remove a number of items. In Windows 10, Disk Cleanup offers eight cleaning options.

Disk Cleanup options. (Image Credit: Daniel Petri)
Disk Cleanup options. (Image Credit: Daniel Petri)
  • Downloaded program files
  • Temporary internet files
  • System archived Windows error reporting files
  • Delivery Optimization Files
  • Recycle Bin
  • RetailDemo Offline Content
  • Temporary Files
  • Thumbnail Cache

There are many more options you can choose from. If you click on the “Clean up system files” button, you get these additional cleanup options:

  • Windows Defender
  • Windows Upgrade Log Files
  • Downloaded program files
  • Temporary internet files
  • System archived Windows error reporting files
  • Delivery Optimization Files
  • Device Driver Packages
  • Previous Windows Installations
  • Recycle Bin
  • RetailDemo Offline Content
  • Temporary Files
  • Temporary Windows installation files
  • Thumbnails

 

And even then there are more options, but some of them are not available through the regular UI. To see a full list of Disk Cleanup option:

1. Open Command Prompt with administrative permissions.

2. Type in the following line (just copy and paste), then press Enter:

FOR /F  "usebackq tokens=8 delims=\" %i IN (`reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches"`) DO @echo %i

Additional DiskCleanup options. (Image Credit: Daniel Petri)
Additional DiskCleanup options. (Image Credit: Daniel Petri)

Running Disk Cleanup via Command Prompt

Now, if we want to run the Disk Cleanup from the Command Prompt and have it run the cleaning process without any user intervention, we need to prepare the system first.

1. In the Run command, type the following line, and press Enter:

cleanmgr /sageset:1

Running Disk Cleanup from the command prompt. (Image Credit: Daniel Petri)
Running Disk Cleanup from the command prompt. (Image Credit: Daniel Petri)

Note: You can choose any number from 1 to 255, and once used, it will store the selected options in the Windows Registry in the following path:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches

Now, manually select any option, and you can click on the “Clean up system files” button to get even more options.automating-disk-cleanup-10

Note: Unlike my previous example, running Disk Cleanup via the command prompt does not show you how much disk space it’s going to free. This is the setup stage, no calculation is done.

 

If you execute cleanmgr /sagerun with the same number, it will perform the tasks defined in the “sageset” command.

1. In the Run command, type the following line, and press Enter:

cleanmgr /sagerun:1

automating-disk-cleanup-13

Before running the command, I had 33.9 GB free space on the C:\ drive. After running the command, I had 47.5 GB free space on the C:\ drive.

Result of freed disk space after running Disk Cleanup in Windows 10. (Image Credit: Daniel Petri)
Result of freed disk space after running Disk Cleanup in Windows 10. (Image Credit: Daniel Petri)

 

Related Topics:

BECOME A PETRI MEMBER:

Don't have a login but want to join the conversation? Sign up for a Petri Account

Register
Comments (0)

Leave a Reply

Live Webinar: Active Directory Security: What Needs Immediate Priority!Live on Tuesday, October 12th at 1 PM ET

Attacks on Active Directory are at an all-time high. Companies that are not taking heed are being punished, both monetarily and with loss of production.

In this webinar, you will learn:

  • How to prioritize vulnerability management
  • What attackers are leveraging to breach organizations
  • Where Active Directory security needs immediate attention
  • Overall strategy to secure your environment and keep it secured

Sponsored by: