I've been poking around trying to get Disk Cleanup to run when my Windows XP Pro SP2 machine shuts down.
The main reason for this is to clean
Local Settings/Temp to remove old junk automatically. (I had thought I had this covered through Firefox settings, but I was only clearing temporary Internet files). Currently, there's around 3 GB of temporary files, and I'd like to prevent this build up without having to remember to do anything on my part.
So far, I have attempted to automate Disk Cleanup using a user logoff script in the Group Policy Editor (as per these instructions using
cleanmgr /sageset:1 and
cleanmgr /sagerun:1), but it doesn't seem to be executing correctly.
In particular, I'm seeing log entries such as
Execution of GPO scripts has timed out and have been terminated."
that suggest the script isn't completing successfully. Also, when I ran the command that the script contains I left my computer for a while. On my return, I found it had shutdown and not completed the Disk Cleanup.
Why doesn't Disk Cleanup appear to be executing correctly, or is there a better approach?
After a bit of fiddling around, it seems that the timeouts were caused by the large amount of temporary files and the amount of old files to compress. I've not been able to reliably duplicate the shutdowns I've been getting when running the
cleanmgr command, but suspect it was also related to the timeouts.
However, Disk Cleanup doesn't seem to be cleaning
C:\Documents and Settings\Chris\Local Settings\Temp\ as I expected it would. While all other temporary files/folders appear to be cleaned, this particular folder is seemingly untouched.
As I suspect that Disk Cleanup simply isn't meant to clean that folder (although, I don't understand why that wouldn't be the case), I have asked a more general question about how to automatically delete the temporary files in