Please let us know how useful you find this tip by rating it below. Do you have a useful Windows tip, timesaver or workaround to share? Submit it to our tip contest and you could win a prize!
I recently became curious if the Windows Disk Cleanup tool could be automated. Could the task of performing cleanup operations on client computers be done on a routine basis without requiring user intervention?
Although I didn't find the perfect solution to complete the task, I did find a helpful alternative. The NTRegMon tool from www.sysinternals.com will monitor the registry of a system while you run the Disk Cleanup tool. (I've provided a sample of the SMS Installer script below.)
Basically, the tool accepts a number of command-line parameters to dictate what actions should to be initiated. It also modifies the appropriate registry entries and then launches the "cleanmgr" executable.
I tested the NTRegMon tool on a Windows XP SP2 system featuring Office 2003. I hope you find it as useful as I did. These are the available command-line parameters:
- -ASTF = Active Setup Temp Folders
- -COF = Compress Old Files
- -CIC = Content Indexer Cleaner
- -DPF = Downloaded Program Files
- -ICF = Internet Cache Files
- -MDF = Memory Dump Files
- -MOTF = Microsoft Office Temp Files
- -MERTF = Microsoft Event Reporting 2.0 Temp Files
- -OSF = Office Setup Files
- -OF = Offline Files
- -OPF = Offline Pages Files
- -OCF = Old Chkdsk Files
- -RB = Recycle Bin
- -RDCF = Remote Desktop Cache Files
- -SLF = Setup Log Files
- -SR = System Restore
- -TF = Temporary Files
- -TOF = Temporary Offline Files
- -UBI = Uninstall Backup Image
- -WWC = WebClient and WebPublisher Cache
Please keep in mind that this code is a proof of concept project for me. If you are interested in using this in your particular IT environment, then I highly recommend that you spend some quality time verifying that everything works as expected.
The full code can be found at: 10309SilentCleanmgr.zip.
Editor's Note: If you would like to receive similar tips on how to manage Windows as well as other expert advice, be sure to subscribe to The Administrator Tip newsletter. Sign up now!
Dan Thomson is employed by Aspiration Software as a Systems Administrator and works in the District of Columbia. He is also a contributing author for myITforum.com. You can reach him at firstname.lastname@example.org.
Dig deeper on Windows legacy operating systems