Help running a Disk Cleanup cleanmgr /sagerun with a timeout
I'm working on a package to run a /sageset that I've set up. I've been lazy and just sent
cleanmgr.exe /sagerun:1
but it can spin off forever. I'm trying to send the command, and move to the next step without waiting, put in my own 30 minute wait step, then kill it. From what I understand that the Start command is the way to kick it off and not wait. I can't find any Start command examples with arguments on the exe side. Any suggestions, or at least few laughs at my attempt? This is what I have
1 start /d C:\Windows\System32\ /b cleanmgr.exe /sagerun:1 (with a few variations)
2 The built in sleep step for 30 mins
3 taskkill /im cleanmgr.exe /f
Any ideas?
Comments
Do a PowerShell step with the below:
Start-Process -FilePath "cmd.exe" -ArgumentList '/c "cleanmgr /sagerun:1"' -WindowStyle Hidden