Jump to content
Duvak

Disk Cleanup script failed

Recommended Posts

Hi all. I'm hoping for the power of the community to figure this one out.

The Automate build-in script for Disk Cleanup  (Maintenance - Hard Disk Cleanup - Disk Cleanup) seem to fail on recent Windows 10 machines. It times out on the cleanmgr.exe command.
The reason is a change in windows 10 / Server 2019 with some recent build. Cleanmgr won't run in the backround anymore. The process remains open but doesn't do a thing.

Another source: https://social.technet.microsoft.com/Forums/azure/en-US/edd0156e-95ce-406f-8781-4446ea950b97/cleanmgrexe-cant-be-run-via-task-scheduler?forum=ws2019

I tried running the cleanmgr with the /verylowdisk argument but it didn't change a thing. The only thing that works is running it in the users console session because it seems to interact with the users environment. It doesn't do a thing with the user but still....

Anyone else have seen this problem? And more important: have a fix for it?

 

Another buggy thing by the way in the same script is the hdd space calculator. It uses the powershell command  "(Get-WmiObject Win32_LogicalDisk -Filter DriveType=3).FreeSpace / 1GB" to check free space. But this doesn't work when a computer has multiple volumes. So the ticket that results from here is showing two failed powershell queries.

I'm not sure if I want to address this at Connectwise support. Already got a few tickets on my name and even one from a year ago....

Share this post


Link to post
Share on other sites

I'm not having any issues; However I will note that I had to update my scripts from the stock to look to see if the registry entry for was there that is created when you run the cleanmgr.exe /sageset:1 , and if it wasn't there to insert it ; Just about every machine was failing before I added that logic check. I get a few machines now that will time out on the run; I've pretty much tracked those down to being laptops, and from what I can tell, the system is going to sleep with CleanMGR.exe running, and then when it comes back to, it just hangs.

Share this post


Link to post
Share on other sites
12 hours ago, JBarnesMCOS said:

I'm not having any issues; However I will note that I had to update my scripts from the stock to look to see if the registry entry for was there that is created when you run the cleanmgr.exe /sageset:1 , and if it wasn't there to insert it ; Just about every machine was failing before I added that logic check. I get a few machines now that will time out on the run; I've pretty much tracked those down to being laptops, and from what I can tell, the system is going to sleep with CleanMGR.exe running, and then when it comes back to, it just hangs.

Thanks for your responce. Could you check how the cleanmgr is running? As User, Admin or local system?

It seems to run fine at user %consolesession% because it can interact with the desktop. Running as system seems to go well but will stop working soon because its using the CMD "AT" thats depricated in later version from windows 10. The one that seems to hang with my sessions is the ones running as admin.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...