SEARCH

How-To Geek

Disk Cleanup in Server 2008, Part 2: Schedule a cleanup

Keeping your servers clutter-free is easy with Disk Cleanup, and scheduling a cleanup makes it effortless.

Since we added Disk Cleanup in our previous article, we now have the ability to assign preset parameters for running it. In the Run bar, we’ll enter:

cleanmgr.exe /sageset:1

Any number between 1 and 65535 can be assigned, so we’ll start with preset #1.

sshot-2010-01-25-17-15-56

When we hit enter, the Disk Cleanup Setting box will appear and prompt us to enter the files we would like deleted. Once we’re finished, we’ll click OK.

sshot-2010-01-25-17-17-11

Next we’ll open up Task Scheduler by clicking on the program or entering Task Scheduler in the Run box.

sshot-2010-01-25-17-20-24

Once Task Scheduler opens, we’ll click on Create Task in the right-hand column.

sshot-2010-01-25-20-13-10

We’re going to name our task DiskClean, and click on the radial button Run whether user is logged on or not so that the task will proceed even if another user is logged on. We’re also assigning the administrator user account to this task, since it has the permissions required to run it.

sshot-2010-01-25-17-34-27

Next we’ll click on the Triggers tab, and then click the New button.

sshot-2010-01-25-17-42-02

You could get more detailed with your triggers, but for our purposes here, we are simply going to set our task to occur at a specific time each day.

sshot-2010-01-25-17-42-53

Next we’ll go to the Actions tab and click on the New… button.

sshot-2010-01-25-17-35-01

Click on the Browse button next to the Program/script box.

sshot-2010-01-25-17-35-25

Under the System Tools, we’ll select Disk Cleanup and press OK.

sshot-2010-01-25-17-36-38

Now we’ll need to tell Task Scheduler to run with our previously assigned settings for condition #1, so we enter

/sagerun:1

in the Add arguments box, and click OK.

sshot-2010-01-25-17-37-06

Once the program has been added to the Actions, click the OK button at the bottom of the Create Task window. You will get prompted to enter the password for the user account that you assigned to the task under the General tab earlier.

sshot-2010-01-25-17-37-52

It may take a few minutes to show up, but you can now see and edit your newly created task in the Active Tasks pane of the Task Scheduler.

sshot-2010-01-25-17-50-22

The Task Scheduler is a flexible tool, and we’ve shown here how it can easily be used to achieve our goals, like have a clutter-free server.

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.

  • Published 01/26/10

Get Free Articles in Your Inbox!

Join 134,000 newsletter readers

Email:

Go check your email!