It often seems that many of the calls help desks receive from users are related to poor system performance or other issues that could be avoided by performing the occasional bit of routine maintenance. However, I don’t personally know a single administrator who has the time to go to every workstation and optimize it on a regular basis. Such a task would be a very time-consuming chore in a small organization, and would be nearly impossible in a large organization. Fortunately, there are ways to make the system perform these tasks for you. In this article, I’ll discuss some methods of automating Windows 2000 maintenance.
The Task Scheduler
The secret to automating common tasks is the Task Scheduler. The Task Scheduler is a small program that’s built into Windows 2000. It allows you to run a program or a script at a certain time. You can set up Task scheduler to run a program or script once, or on a regular basis.
You can access the Task Scheduler by selecting Start|Programs|Accessories|System Tools|Scheduled Tasks. By default, the only thing in the Task Scheduler is an option to add a scheduled task. Therefore, let’s get started by double-clicking the Add Scheduled Task icon. Doing so launches the Scheduled Task Wizard. Click the Next button to jump into the wizard. The first functional screen, shown in Figure 1, asks for the program you want Windows to run. The screen contains a list of all the programs Windows is aware of. If you’re used to the Windows 98 style Task Scheduler, this screen may be a bit of a surprise. However, even though this wizard works a little differently from the Windows 98 version, it tends to be easier to use.
Click to see Figure 1
At this point, select the program you want to run from the list. If you don’t see the program on the list, click the Browse button and search the workstation for the desired program. Once you’ve made your selection, click Next to continue. The next screen asks how often you want to perform the task. You have several options, including things like one time only, daily, weekly, monthly, when I log on, or when my computer starts. Make your selection and click Next to continue. The next screen you see will depend on the selection you’ve made. It will relate to the start date and time to run the program. It may also contain other options. For example, if you chose to run the program on a daily basis, this screen will give you the option of running the program every day, weekdays only, or every certain number of days. When you’ve made your selections, click Next. At this point, you’ll see a screen that asks for a login name and password. Automated tasks are often set to run late at night when no one is using the system. Therefore, the system requires login credentials so that it may run the task. If you’re worried about security, relax. The system never completely logs on–it merely runs the programmed task as if the user you specified were logged in. Finally, when you click Next, you’ll see a summary screen outlining the automated task that you’ve set up, as shown in Figure 2. However, the options you’ve set through the wizard often are not enough. For example, if you tell the wizard to run the Backup program every night, the Task Scheduler will do exactly that. It will launch the Backup program. However, it won’t back up your system until you tell it to. Therefore, it’s often necessary to add some extra commands. To do so, select the Open The Advanced Properties For This Task When I Click Finish check box and then click the Finish button.
Click to see Figure 2
Automating Common Tasks
After you click the Finish button, you’ll see the task’s properties sheet. You can make changes to the task’s schedule or settings through the respective tabs. However, the main tab you’re interested in right now is the Task tab. The Task tab contains a command line, the name of the startup directory, and the name of the account that will be running the task. Normally, you won’t have to modify the startup directory or the account name, but it’s nice to know they’re there, just in case. The command line is what you’ll have to change. The changes that you make will really depend on the application you’re running and the options you want to use. For example, let’s look at the Backup program I discussed earlier. As I mentioned, if you run it as is, Task Scheduler will merely open the Backup program. If you want it to do more, look at the filename and path of the Backup program (or any program that you’re using). Next, open a command prompt window and navigate to the program’s path. Enter the executable followed by a question mark. For example, to check out the Backup program, you’d enter the following commands: C:
When you do, you’ll see a list of command-line switches that you can use to perform various tasks from the command line. For example, in the case of the Backup program, you could specify the /J parameter followed by the name of the Backup job that you want to run. Almost any built-in Windows 2000 program will contain similar options. Now that you know how to schedule a task, the question remains, what types of tasks should you schedule? Of course, that will depend on your particular environment. However, many administrators like to schedule such tasks as antivirus updates and disk defragmentations. You may even schedule scripts to run and clean unused temporary files from your hard disk. In part 2, I’ll discuss some of the more common tasks that that you can schedule and provide some more hints about how to automate difficult applications. // Brien M. Posey is an MCSE who works as a freelance writer and as the Director of Information Systems for a national chain of health care facilities. His past experience includes working as a network engineer for the Department of Defense. Because of the extremely high volume of e-mail that Brien receives, it’s impossible for him to respond to every message, although he does read them all.