Automating System Maintenance

Windows has some nifty built-in system maintenance tools. Disk Cleanup, for example, rids your hard drive of unneeded temporary files. Disk Defragmenter reorganizes your files for optimum system performance. Sadly, though, there’s not an easy “just click here” way to automate those utilities. That doesn’t mean, however, that you can’t automate those tasks:

Automating Disk Cleanup

You can make Disk Cleanup run as often as you’d like. It takes a little bit of work, although once it’s up and running, you don’t have to do anything else:

1) Click Start > Run

2) Type “cleanmgr.exe /sageset:50” (without the quotes) into the “Run:” box. Note that you can use any number between 0 and 65535 with the /sageset switch. I chose the number in my example (50) for simplicity reasons.

3) A window will appear that looks much like the standard Disk Cleanup screen. Choose which options you’d like Disk Cleanup to clean and then click “OK”.

4) Click Start > “Control Panel” > “Scheduled Tasks” > “Add Scheduled Task”.

5) Click “Next” (there will be a considerable delay between this step and the next).

6) You will be presented with an alphabetical list of most of the programs on your system. Scroll down and choose “Disk Cleanup”, then go on to the next step. If you don’t see “Disk Cleanup” listed, click “Browse” and navigate to the Windows\System32 folder and click on “cleanmgr.exe”.

7) Give the task a name and choose how often you’d like the task to run, then click “Next”.

8) Refine your time choices on the following screen, then click “Next”.

9) Enter the user name and password of the account you’d like the task to run under (usually this would be your own user name and password), then click “Next”.

10) Make sure that the “Open advanced properties for this when I click Finish” box is checked, then click “Finish”.

11) In the window that opens, look for the “Run:” box near the top of the screen. Type in “/sagerun:50” at the end of the run command, so that the complete text looks something like this:

C:\WINDOWS\system32\cleanmgr.exe /sagerun:50

12) Click “OK”. You be probably be prompted to enter your user name and password again; do this.

As you might guess, you can run the SAGESET option with different numbers to create multiple “profiles” for Disk Cleanup to use. For example, you might want to have Disk Cleanup clear out your Temporary Internet Files daily, but only do a “deep cleaning” once a week. In this case, you’d run SAGESET with one number (say, 50) and choose only the “Temporary Internet Files” option. You can then run SAGESET again with another number (say, 51) and choose to clean out all options. You’d then schedule one task to run daily with the /sagerun:50 option, and another task to run weekly with the /sagerun:51 option.

Automating Disk Deframenting

Thankfully, automating Disk Defragmenter is much easier than Disk Cleanup:

1) Click Start > “Control Panel” > “Scheduled Tasks” > “Add Scheduled Task”.

2) Click “Next” (there will be a considerable delay between this step and the next).

3) Click “Browse”, navigate to the Windows\System32 folder and click on “defrag.exe”.

4) Give the task a name and choose how often you’d like the task to run, then click “Next”.

5) Refine your time choices on the following screen, then click “Next”.

6) Enter the user name and password of the account you’d like the task to run under (this would usually be your own user name and password), then click “Next”.

7) Make sure that the “Open advanced properties for this when I click Finish” box is checked, then click “Finish”.

8) In the window that opens, look for the “Run:” box near the top of the screen. Type in “c:” at the end of the run command (or d: or e: or whatever drive you’d like to defrag), so that the complete text looks something like this:

C:\WINDOWS\system32\defrag.exe c:

9) Click “OK”. You be probably be prompted to enter your user name and password again; do this.

Remember that this only applies to Windows’ built-in disk defragmenter. If you use PerfectDisk, O&O or some other defragmenter, it will likely have its own built-in scheduler, or its own set of command-line switches for running automated tasks. If you use one of these third-party defragmenters, you probably don’t want to use the Windows defragmenter at all, since different defragmenting utilities use different schemes for defragmenting your disks.

One Reply to “Automating System Maintenance”

  1. I use CCleaner for the diskcleanup and run it whenever i delete lots of files or after long sessions of browsing and downloading. As for the defrag, i always had a problem trying to get the defragger to complete, not to mention excruciatingly long hours it took to complete each partition. So i got myself an automatic program. It actually completes the defrags faster. since its set to run in the background, i dont have to check if the scheduled task worked or not etc. Drives in pretty good shape and PC runnin great.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.