Skip to main content

Run Disk Cleanup - Windows

Summary​

This is a CW RMM task that will run the Cleanmgr included in Windows. It will set all optional Cleanmgr targets to enabled, except for the Downloads folder. The script will output both before and after available disk space when the tool was run.

Sample Run​

Image

Select Run Now and click Run Task

Image

Task Creation​

Script Details​

Step 1​

Navigate to Automation ➞ Tasks
step1

Step 2​

Create a new Script Editor style task by choosing the Script Editor option from the Add dropdown menu
step2

The New Script page will appear on clicking the Script Editor button:
step3

Step 3​

Fill in the following details in the Description section:

  • Name: Run Disk Cleanup - Windows
  • Description: Runs the Cleanmgr included in Windows. It will set all optional Cleanmgr targets to enabled except for the Downloads folder.
  • Category: Maintenance

Image

Script Editor​

Click the Add Row button in the Script Editor section to start creating the script
AddRow

A blank function will appear:
BlankFunction

Row 1 Function: PowerShell script​

Search and select the PowerShell script function.

Image

Paste in the following PowerShell script and set the Expected Time of Script Execution to 300 seconds. PowerShell Script

Image

Save and move to the next row

Row 2 Function: Script Log​

Search and select the Script Log function.

Image

In the script log message, simply type %output% so that the script will send the results of the PowerShell script above to the output on the Automation tab for the target device.

Image

Save Task​

Click the Save button at the top-right corner of the screen to save the script.
SaveButton

Completed Task​

Image

Output​

  • Script Log

Changelog​

2025-07-10​

  • Initial version of the document