Task Scheduler in Windows Vista is more
reliable, more scalable, and much easier to use than in previous
versions of Microsoft Windows. The following sections describe the
features and enhancements of this tool.
1. Task Scheduler Enhancements and Improvements
The new Task Scheduler version provides significant improvements in the following areas:
User Interface Improvements
The Windows Vista Task Scheduler features a
completely new user interface based on Microsoft Management Console
(MMC). The interface includes a number of new conditions and filters to
assist administrators in defining and managing scheduled tasks.
Scheduling Improvements
Time-based task launch in Windows Vista Task
Scheduler has been improved with higher granularity and enhanced
scheduling options. One key improvement allows you to chain a series of
actions together instead of having to create multiple scheduled tasks.
You can schedule tasks on demand for execution
when a specified event is logged to an event log. You can configure
scheduled tasks to wake a computer from sleep or hibernation or to run
only when the computer is idle. You can also run previously scheduled
tasks when a powered-down computer is turned back on.
Scalability has been improved by removing
limitations on the number of registered tasks and allowing multiple
instances of a task to run in parallel or in sequence.
Security Improvements
New security features include use of Windows
Vista’s new Credentials Manager (CredMan) to securely store passwords
needed for running tasks, and also supporting Service for User (S4U) for
many scenarios such that passwords do not need to be stored at all.
To further increase security, scheduled tasks
are executed in their own session instead of the same session as system
services or the current user:
Separate per-user credentials are required for Winstations and Desktops.
System tasks run in the system session (session 0), while user tasks run in the user’s session.
Improved credentials management provided by S4U
and Credentials Manager also increases reliability and reduces
maintenance overhead.
Administrative Improvements
Windows Vista also includes features to enhance the administration experience for scheduled tasks.
Scheduled tasks may be activated by Event Log
events and may be synchronized using operational events fired by the
service (these may be viewed in Event Viewer under Applications And
Services Logs/Microsoft/Windows/Task Scheduler/Operational log). Tasks
may be configured to retry on failure and activated when resources
become available, as in the case of mobile devices that may miss run
times of scheduled tasks.
Control and task status monitoring has been
improved and now provides detailed failure reporting and task history.
Status feedback has been significantly improved. For example, using the
detailed events logged by the Task Scheduler about task operation, an
administrator can set up an email to be sent to him/her when a failure
occurs, including a complete runtime history of the event. In addition,
the complete history of executed scheduled tasks can be easily reviewed,
and at any time the administrator can view the list of currently
running tasks, and run or stop tasks on-demand.
To assist administrators in scripting complex tasks, the Task Scheduler API is now fully available to scripting languages.
Platform and Manageability Improvements
Windows Vista Task Scheduler enables several
new features that improve platform operations and manageability.
Infrastructure features for application monitoring now allow hosting and
activation of troubleshooters and other corrective actions. Periodic
data collection has been implemented to improve event detection. Task
process prioritization has been improved and quotas may be assigned.
Computer resources are used more efficiently by activating tasks based
on a true idle state, defined by a combination of the following criteria:
2. Operational Overview
A task has a set of one or more Triggers, execution conditions named Settings, and an execution body named Actions.
Task Triggers
A task trigger is the condition or conditions
under which a task is launched. A task trigger defines when a task will
begin and can include conditions such as running a task when a system is
started, when a user logs on to a computer, or when a specific event is
logged in the event log. A task may have one or more triggers defined.
This means that the task will be launched whenever one of the triggers’
conditions is met.
Task Settings
Task settings are conditions besides the
trigger under which a task will execute, and they also control the
behavior of the task. Task settings include conditions such as running
the task only if the computer is idle, or running it only if the
computer is connected to a specific network. Other task settings include
allowing a task to run on demand, allowing to forcefully end a task,
defining actions to take when a task fails, and deleting a task after it
runs.
Task Actions
A task action is the code that executes when
the task is run. The body of a task can be a script, batch file,
executable, or a component written as a handler to the Task Scheduler
interface. (This applies to operating system components only.) The
execution hosts for task actions are called task scheduler engines. A task may define one or more actions to be run consecutively as part of the task execution.
User Interface
The Task Scheduler user interface has been
integrated as an MMC console and provides an intuitive experience for
administrators. Command line capabilities include use of JOB.EXE in the
current shell, the SchTasks.exe command-line tool for administrative and
scripting use, and the legacy command-line task interface known as AT.
3. Task Scheduler Architecture
Task Scheduler supports an isolation model in
which each set of tasks running in a specific security context is
launched in a separate session. Task scheduler engines running in
transient processes in the user or computer context process the
execution defined for launch by a trigger. Tasks can be launched in a
computer account context such as LocalSystem, LocalService, or
NetworkService, or they may be launched in a specified user context.
Task Scheduler also attempts to ensure task integrity even when a user’s
domain credentials are updated (applies to Windows Server 2003 domains
only).
Tasks can be launched either locally or
remotely. Each task may contain multiple actions running in series.
Multiple tasks can be launched in parallel or serially to perform a
series of synchronized operations using the events logged by the
service. A set of predefined events in the System event log as well as
the private Task Scheduler Operational event log are used to record each
action’s execution status for monitoring, synchronization, and health
management.
Task Scheduler Components
The simplified block diagram shown in Figure 1 illustrates the high-level architecture implemented in Task Scheduler.
Task Scheduler combines several components that
work together to provide the Task Scheduler user interface, the task
execution engine, and event tracking and management.
The Task Scheduler user interface has been
redesigned in the MMC .NET snap-in SchedTask.msc. This graphical user
interface includes a wizard for creating and configuring tasks and
property pages that accesses the Task Scheduler service through through
its COM API.
A shared svchost.exe loads the Task Scheduler
Service DLL SchedSvc.dll using a LocalSystem account, uses the
TaskSchd.dll component to interface with the Resource Manager, and uses
S4U to obtain the required credentials. This service DLL also reads
configuration information from the registry and writes job tasks to the
disk in XML format.
The Transient Control Process engine
TaskEng.exe runs in the context of the task-defined user account, logs
Event Log status events and generates user processes that execute
actions defined by the task.
The TaskComp.dll component provides
backward compatibility for management and execution of tasks that were
created in previous versions of Windows.