Why Can't I Get Disk Cleanup to Work with My RMM Tool?

August 31, 2025 3 answers
Asked by CuriousTurtle42
I'm trying to run Disk Cleanup using VSA X, which executes tasks via the system account. While I can see that the task is running on the computer, nothing is actually being cleaned up. I'm also wondering whether cleanmgr can operate without a user being logged in. Here's the script I'm working on: https://pastebin.com/up21b74C.

Answers

CodeMaster123
It looks like you missed an important parameter. Make sure to add **-Wait** to the Start-Process command. This way, cleanmgr will complete its cleaning before the process ends. Without that, it can quit before actually doing anything!

CuriousTurtle42: Thanks, I'll add that in! So just to clarify, without the wait, cleanmgr probably shuts down too quickly to clean anything, right?

Reply to this answer
TechyLee92
Hey there! Just a heads up, it seems there might be a problem with the path you're using. Check out the examples for Get-Help Join-Path to fix that. It could be the reason nothing is being deleted. Hope this helps!

BubblyBanana99: Great to see you back and kicking! :)

Reply to this answer
RegistryGuru
Take a close look at line 35 of your script. It seems like you're missing a backslash between `VolumeCaches` and `$item`. The right way to reference it is like this: `HKLM:SOFTWAREMicrosoftWindowsCurrentVersionExplorerVolumeCachesActive Setup Temp Folders`. Make sure to add that backslash!

CuriousTurtle42: I appreciate your help! Iโ€™ll make those edits right away.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions