Running Disk Cleanup Silently


I have the below running as an online shell script. It seems to run fine but when it runs the scheduled task it jut seems to sit there forever. The Registry keys go in so effectively taking care of /SageSet:100 and if I run the command locally it works fine. I have ensured that I am putting the registry keys into the 64 Bit hive but when it runs I see that Disk Cleanup has started as a background task but it seems like its just sitting there waiting for input like to be told what to run. 

It runs as the Local System User and I have tried running it as an admin user with the same result. 

Reg Import DiskCleanupSettings.reg /reg:64

schtasks /create /tn DiskCleanup /tr "C:\Windows\System32\cleanmgr.exe /sagerun:100" /sc once /st "14:40" /RL HIGHEST /ru System

schtasks /run /tn DiskCleanup

Does anyone have any ideas on what might be the issue?



0 Comments   [ + ] Show comments

Answers (1)

Posted by: prince0052 1 year ago
Senior Yellow Belt

requires you to run sageset first,

cleanmgr /sageset:5

then you can just run this in the script

cleanmgr /verylowdisk /sagerun:5

  • Thank you for your comment. I have done this on my machine and then exported the registry file for the settings. As the file puts the registry items in 64 bit part of the registry do you think it needs to be put into the 32 bit part of the registry as well? or just the 32bit part of the registry?

    Either way I have tried this but it still seems to do the same thing. I have tried running as the local system account so it has admin privileges.

    Thanks - Morpheus83uk 1 year ago

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:


This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ