Aug 102012
 

Early today I was looking for a way to automatically run Disk Cleanup on multiple computers in a domain. I found the /sageset switch which allows you to define the options you want to use in conjunction with /sagerun, but none of the articles mentioned anything about saving the settings for use on multiple computers. Using Regshot 2.0 unicode on Windows XP I determined the settings are saved in:

HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\VolumeCaches

There is a key for each category and a StateFlags dword value for each configuration made using /sageset. The StateFlags value has a number after it that corresponds to the /sageset number. By exporting a the VolumeCaches key and merging in before running cleanmgr /sagerun, you can easily deploy a Disk Cleanup policy. I won’t have time to thoroughly test this on different machines until Monday, so USE WITH CAUTION.