We are looking to automate some disk cleanup operations on our Windows 10 desktops using the built in Disk Cleanup utility to clean up Windows Updates files (winsxs dir) and windows.old.
I know it can be somewhat automated using the cleanmgr commands so we first manually used : cleanmgr /sageset:555 and set the options we wanted which threw in the appropriate registry entries . I exported the key from HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches and cleaned it up to only have the StateFlags keys
So anyways our PDQ package i created first deployed that registry key i mentioned and then next step runs:
cleanmgr /verylowdisk /sagerun:555
That all seems to work just fine however it seems to complete very quickly after the 2nd command is run even though the actual cleaning process goes on for quite a while while it does its thing. I know its probably just reading the powershell error codes for that but curious if anyone has any ideas how to expand on this to get better completion reporting from PDQ on this type of operation? (or if theres a better way to handle it)
Please sign in to leave a comment.