Often, the best time to perform maintenance for
performance and disaster recovery is late, late at night, when all the
users are at home and asleep, and the servers and the network are at
their quietest. The problem is that at that time of the night, all the
administrators are also at home and fast asleep. So how should you get
your maintenance tasks running at two o’clock in the morning? Why, the
Task Scheduler is your tool to do this, of course.
The Task Scheduler is
located in Control Panel > System and Maintenance > Administrative
Tools. It has a new look and feel in Windows Vista, and has features
and capabilities like never before.
The old Task Scheduler in
Windows XP and even in Windows Server 2003 was (is) pretty basic; to use
it, you followed these steps:
1. | Select an
executable or script to run.
|
2. | Input credentials to run the task.
|
3. | Set the schedule.
|
You were done in about
three steps.
Tip
The Task Scheduler relies on an
underlying service named (Surprise!) the Task Scheduler service. This
service may have been stopped for security and performance reasons. If
you plan to configure scheduled tasks, you should verify that the Task
Scheduler service is started.
The new Task Scheduler
has a large library of preconfigured, system-related tasks. Some tasks
are active and are already performing their duties in the background.
Some tasks are lying dormant, waiting for someone to set a valid trigger
to activate them.
As shown in Figure 1,
the library of preconfigured tasks covers a wide range of targets.
To make adjustments to the
existing tasks, click the Properties hyperlink in the Actions pane on the right.
This brings up the configuration details, as shown in Figure 2. The General tab shows which credentials are used to run
the task.
Alert
On
the Triggers tab, you can configure what causes your application to run.
As you can see in Figure 3, you have many new options to choose from. Notice that triggers
can even be generated from specified events within Event Viewer.
Multiple different triggers can be included on the Triggers list.
Alert
On
the Actions tab, you can configure what the Trigger event causes to
happen. As you can see in Figure 4, you can start a program, send an email, or display a
message on the console. Multiple actions can be included on the Actions
list.
A new setting on the
Conditions tab is to start the task only if a specified network
connection is available. The Settings tab has a new option on what to do
if an instance of the task is already running. The choices include
Do Not Start a New Instance
Run a New Instance in Parallel
Queue a New Instance
Stop
the Existing Instance
And finally, the History
tab shows a log of activity related to this one task.
Tasks are now recorded in XML
files. These XML files can be easily exported and imported onto other
Windows Vista computers.
Command-Line Task
Scheduler Tools
Surprisingly, the old AT
command-line Task Scheduler tool is still around and kicking. But the
recommended command-line tool to use is called SchTasks.exe. This tool isn’t new in Vista but is newer than AT.
While SchTasks can’t
use triggers other than the clock, and can launch only executables and
scripts, you can use SchTasks with
these switches to perform the following functions regarding scheduled
tasks:
Run—
Launches the scheduled task immediately
End— Stops the currently running scheduled
task
Query—
Displays all scheduled tasks
Change— Changes the properties of the
scheduled task
Create— Creates a new scheduled task
Delete— Deletes the
scheduled task(s)
You should be familiar
with these basic functions available with this command-line utility for
the exam.