Event management includes close ties to system
automation because you often need to generate automatic actions when
specific events occur. For example, one of the most common tasks that is
related to events is the automatic deletion of temporary files when
disk drives get too full. Or in another scenario, you may require an
automatic notification when unauthorized users try to log on to
workstations that contain access to highly sensitive or confidential
information.
In order to automate either notifications or
tasks, you need to rely on the Task Scheduler. In Vista, the Task
Scheduler has become much more of a real job scheduler. Like the Event
Viewer and the Event Log system, the Task Scheduler has been completely
rewritten and now offers several enhancements over the Task Scheduler
found in previous versions of Windows. For one thing, the Task Scheduler
now maintains a complete library of all scheduled tasks, all
categorized according to source. In addition, like the Event Viewer, the
Task Scheduler profits from a new interface based on the Microsoft
Management Console (MMC) version 3.0 as shown in Figure 1.
As with all MMC version 3 interfaces, this one
sports three panes — moving from left to right, the first is the Tree
pane, the second is the Details pane and the third is the Action pane.
As you can see, the main Task Scheduler details pane displays task
summaries, task status, and active tasks, giving you ready access to any
task information.
Tasks in Vista are based on two main components:
So far, this isn't very different than previous
task automation features found in other versions of Windows, but Vista's
Task Scheduler is a far cry from the Windows NT AT command. Previous
versions of Windows had serious drawbacks when it came to system
automation. In Vista, all of these situations have been corrected.
Vista now includes a whole series of new triggers
— events; machine status such as idle, startup, logon, and so on;
session state changes such as opening or closing of Terminal Services
sessions, or lock or unlocking of sessions; or even the more
conventional time-based task startups. Tasks can even use other tasks as
triggers, letting you create new, conditional, or chained tasks and
then, once the task has been initiated, have it repeat regularly or in
other situations, add delays or other limits to a task. In addition,
tasks can run on universal time so that global organizations can create
tasks in one time zone and ensure they run properly in any time zone.
Each task can include more than one trigger
ensuring the task will run if any of the launch elements occur. Along
with triggers, tasks include conditions that determine how the task will
behave as can be seen in Figure 2.
Conditions control if the task should run while the system is idle, if
the task should run while the system is on battery power, if the system
should be booted up to run the task should it be turned off, or even if
the system should be linked to a network for the task to run.
Settings control whether the task can be run
manually, what should happen if the system was turned off when the task
start time occurred, what to do if the task does not complete or fails
or even runs too long. Settings can also apply rules to a task. These
rules can include what to do if the start time occurs and an instance of
the task is already running, or even delete the task once it has run.
Actions can be any number of items including
running a program, sending an e-mail, or simply displaying a message.
This makes the Task Scheduler very powerful indeed since you could
automatically display a warning message to users whenever they try to
access protected areas of their system. This makes a strong case for
running locked-down systems, and the Task Scheduler gives you the tools
you need to make sure the systems stay locked down and users curb their
habits.
Of course, actions can also be more traditional
and actually run programs. This is after all what the Task Scheduler was
originally designed to do. And sending messages is also quite useful
because administrators can receive notifications when tasks occur. For
example, if you want to make sure that a critical task was performed on a
system, then create a conditional task that sends an e-mail after the
other task completes. Doing this saves you from having to verify task
logs after the task was scheduled to run.
Vista even hides tasks and otherwise controls
which credentials should be used when a task is run. In most cases,
credentials are not stored in the task so you can change account
passwords centrally without having to worry about all tasks failing. In
some scenarios, though, credentials are stored in the secure Credential
Manager store. In these cases, you still need to modify passwords
locally but not in the task.
You can also use the Task Scheduler to create
tasks either for Vista systems or for down-level versions of Windows.
Tasks can be exported in XML format and reimported to any other system.
This makes it very easy to generate tasks on one system and ensure that
they run on all the systems in organizations of all sizes.
Finally, each task includes a history of
operation, listing all of the events that indicate when the task was run
and for how long. This feature makes monitoring tasks and making sure
they run when expected very easy.
Tasks can be created in one of three ways. The
first lets you create a basic task and runs you through a wizard that
takes you through each step required to build the task. Advanced tasks
are created by using the Create Task command that can be found either in
the Context menu or in the Action pane. Create Task opens the Task
dialog box and gives you access to each of the elements that make up a
task. Finally, you can create and manage tasks through the command line
through an updated "schtasks.exe" command. This command lets you script
operations, such as importing tasks on different systems.
Overall, the Task Scheduler is a much more
powerful engine for task management and automation on Vista, and when it
is linked to the Event Log, Task Scheduler becomes a very strong engine
for proactive systems management.