Task Scheduler
Encyclopedia
Task Scheduler is a component of Microsoft Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...

 that provides the ability to schedule the launch of programs or scripts at pre-defined times or after specified time intervals. It was first introduced in the Windows 95
Windows 95
Windows 95 is a consumer-oriented graphical user interface-based operating system. It was released on August 24, 1995 by Microsoft, and was a significant progression from the company's previous Windows products...

 Plus! pack
Microsoft Plus!
Microsoft Plus! was a commercial operating system enhancement product by Microsoft. The last edition is the Plus! SuperPack, which includes an assortment of screensavers, themes, and games, as well as multimedia applications...

 as System Agent but was renamed to Task Scheduler in Windows 98
Windows 98
Windows 98 is a graphical operating system by Microsoft. It is the second major release in the Windows 9x line of operating systems. It was released to manufacturing on 15 May 1998 and to retail on 25 June 1998. Windows 98 is the successor to Windows 95. Like its predecessor, it is a hybrid...

. The Windows Event Log service must be running before the Task Scheduler starts up.

Task Scheduler 1.0

Task Scheduler 1.0 is included with Windows 2000
Windows 2000
Windows 2000 is a line of operating systems produced by Microsoft for use on personal computers, business desktops, laptops, and servers. Windows 2000 was released to manufacturing on 15 December 1999 and launched to retail on 17 February 2000. It is the successor to Windows NT 4.0, and is the...

, Windows XP
Windows XP
Windows XP is an operating system produced by Microsoft for use on personal computers, including home and business desktops, laptops and media centers. First released to computer manufacturers on August 24, 2001, it is the second most popular version of Windows, based on installed user base...

 and Windows Server 2003
Windows Server 2003
Windows Server 2003 is a server operating system produced by Microsoft, introduced on 24 April 2003. An updated version, Windows Server 2003 R2, was released to manufacturing on 6 December 2005...

. It runs as a Windows Service
Windows Service
On Microsoft Windows operating systems, a Windows service is a long-running executable that performs specific functions and which is designed not to require user intervention. Windows services can be configured to start when the operating system is booted and run in the background as long as...

, and the task definitions and schedules are stored in binary
Binary file
A binary file is a computer file which may contain any type of data, encoded in binary form for computer storage and processing purposes; for example, computer document files containing formatted text...

 .job files. Tasks are manipulated directly by manipulating the .job files. Each task corresponds to single action. On Windows 95
Windows 95
Windows 95 is a consumer-oriented graphical user interface-based operating system. It was released on August 24, 1995 by Microsoft, and was a significant progression from the company's previous Windows products...

, Windows 98
Windows 98
Windows 98 is a graphical operating system by Microsoft. It is the second major release in the Windows 9x line of operating systems. It was released to manufacturing on 15 May 1998 and to retail on 25 June 1998. Windows 98 is the successor to Windows 95. Like its predecessor, it is a hybrid...

 and Windows Me
Windows Me
Windows Millennium Edition, or Windows Me , is a graphical operating system released on September 14, 2000 by Microsoft, and was the last operating system released in the Windows 9x series. Support for Windows Me ended on July 11, 2006....

, the Task Scheduler runs as an application (mstask.exe). It also displays a status icon in the notification area on Windows 95 and Windows 98 and runs as a hidden application on Windows Me. On the Windows NT
Windows NT
Windows NT is a family of operating systems produced by Microsoft, the first version of which was released in July 1993. It was a powerful high-level-language-based, processor-independent, multiprocessing, multiuser operating system with features comparable to Unix. It was intended to complement...

 family of operating systems, it is implemented as a Windows service
Windows Service
On Microsoft Windows operating systems, a Windows service is a long-running executable that performs specific functions and which is designed not to require user intervention. Windows services can be configured to start when the operating system is booted and run in the background as long as...

.
Task Scheduler 1.0 exposes an API to programmatically create tasks. It is accessed via the ITaskScheduler COM
Component Object Model
Component Object Model is a binary-interface standard for software componentry introduced by Microsoft in 1993. It is used to enable interprocess communication and dynamic object creation in a large range of programming languages...

 interface.

Microsoft provides a scheduling agent DLL, a sample VBScript
VBScript
VBScript is an Active Scripting language developed by Microsoft that is modeled on Visual Basic. It is designed as a “lightweight” language with a fast interpreter for use in a wide variety of Microsoft environments...

 and a configuration file to automate the Windows 2000/XP Task Scheduler.

Task Scheduler 2.0

Task Scheduler 2.0 was introduced with Windows Vista
Windows Vista
Windows Vista is an operating system released in several variations developed by Microsoft for use on personal computers, including home and business desktops, laptops, tablet PCs, and media center PCs...

 and included in Windows Server 2008 as well. The redesigned Task Scheduler user interface is now based on Management Console
Microsoft Management Console
Microsoft Management Console is a component of Windows 2000 and its successors that provides system administrators and advanced users an interface for configuring and monitoring the system.- Snap-ins and consoles :...

. In addition to running tasks on scheduled times or specified intervals, Task Scheduler 2.0 also supports calendar and event-based triggers, such as starting a task when a particular event is logged to the event log, or when a combination of events has occurred. Also, several tasks that are triggered by the same event can be configured to run either simultaneously or in a pre-determined chained sequence of a series of actions, instead of having to create multiple scheduled tasks. Tasks can also be configured to run based on system status such as being idle for a pre-configured amount of time, on startup, logoff, or only during or for a specified time. XPath
XPath
XPath is a language for selecting nodes from an XML document. In addition, XPath may be used to compute values from the content of an XML document...

 expressions can be used to filter events from the Windows Event Log. Tasks can also be delayed for a specified time after the triggering event has occurred, or repeat until some other event occurs. Actions that need to be done if a task fails can also be configured. The actions that can be taken in response to triggers, both event-based as well as time-based, not only include launching applications but also take a number of custom actions. Task Scheduler includes a number of actions built-in, spanning a number of applications; including send an e-mail, show a message box, or fire a COM
Component Object Model
Component Object Model is a binary-interface standard for software componentry introduced by Microsoft in 1993. It is used to enable interprocess communication and dynamic object creation in a large range of programming languages...

 handler when it is triggered. Custom actions can also be specified using the Task Scheduler API. Task Scheduler keeps a history log of all execution details of all the tasks.
. Windows Vista uses Task Scheduler 2.0 to run various system-level tasks; consequently, the Task Scheduler service can no longer be disabled (except with a simple registry tweak).

Task Scheduler 2.0 exposes an API to programmatically create tasks. It is accessed via the ITaskService COM
Component Object Model
Component Object Model is a binary-interface standard for software componentry introduced by Microsoft in 1993. It is used to enable interprocess communication and dynamic object creation in a large range of programming languages...

 interface. The Windows API does not, however, include a managed
Managed code
Managed code is a term coined by Microsoft to identify computer program code that requires and will only execute under the "management" of a Common Language Runtime virtual machine ....

 wrapper for Task Scheduler. The Task Scheduler API is also exposed for scripting languages, including VBScript
VBScript
VBScript is an Active Scripting language developed by Microsoft that is modeled on Visual Basic. It is designed as a “lightweight” language with a fast interpreter for use in a wide variety of Microsoft environments...

, JScript
JScript
JScript is a scripting language based on the ECMAScript standard that is used in Microsoft's Internet Explorer.JScript is implemented as a Windows Script engine. This means that it can be "plugged in" to any application that supports Windows Script, such as Internet Explorer, Active Server Pages,...

 and Windows PowerShell
Windows PowerShell
Windows PowerShell is Microsoft's task automation framework, consisting of a command-line shell and associated scripting language built on top of, and integrated with the .NET Framework...

. The job files for Task Scheduler 2.0 are XML
XML
Extensible Markup Language is a set of rules for encoding documents in machine-readable form. It is defined in the XML 1.0 Specification produced by the W3C, and several other related specifications, all gratis open standards....

-based, and are human-readable, conforming to the Task Scheduler Schema. Although possible, Microsoft advises not to create the job files by hand, and instead, use the Task Scheduler API. A command line utility for using Task Scheduler is also provided in terms of the schtasks
Schtasks
schtasks is a command which schedules other commands to be run at a certain time. It may run a command once, or repeatedly based upon the day of the week, or the date...

.exe
command.

Other features

  • New security features, including using Credential Manager to store passwords for tasks on workgroup computers and using Active Directory
    Active Directory
    Active Directory is a directory service created by Microsoft for Windows domain networks. It is included in most Windows Server operating systems. Server computers on which Active Directory is running are called domain controllers....

     for task credentials on domain-joined computers so that they cannot be retrieved easily. Also, scheduled tasks are executed in their own session, instead of the same session as system services or the current user.
  • Ability to wake up a machine remotely or using BIOS
    BIOS
    In IBM PC compatible computers, the basic input/output system , also known as the System BIOS or ROM BIOS , is a de facto standard defining a firmware interface....

     timer from sleep or hibernation to execute a scheduled task or run a previously scheduled task after a machine gets turned on.
  • Ability to attach tasks to events directly from the Event Viewer
    Event Viewer
    Event Viewer, a component of Microsoft's Windows NT line of operating systems, lets administrators and users view the event logs on a local or remote machine. In Windows Vista, Microsoft overhauled the event system.- Overview :...

    .

Tasks

The Task Scheduler service works by managing Tasks; Task refers to the action (or actions) taken in response to trigger(s). A task is defined by associating a set of actions, which can include launching an application or taking some custom-defined action, to a set of triggers, which can either be time-based or event-based. In addition, a task also can contain metadata that defines how the actions will be executed, such as the security context the task will run in. Tasks are serialized to .job files and are stored in the special folder
Special Folders
On Microsoft Windows, a special folder is a folder which is presented to the user through an interface as an abstract concept, instead of an absolute folder path...

 titled Task Folder, organized in subdirectories. Programmatically, the task folder is accessed using the ITaskFolder interface or the TaskFolder scripting object and individual tasks using the IRegisteredTask interface or RegisteredTask object.

Last Result

The Last Result column displays a completion code. You can obtain a full explanation of all Windows completion codes from MSDN, but the common codes for scheduled tasks are:

0x0: The operation completed successfully.

0x1: An incorrect function was called or an unknown function was called.

0xa: The environment is incorrect.

Bugs

With Windows 2000 and Windows XP, tasks assigned to run with SYSTEM privileges do not function when the computer is prepared for disk imaging with sysprep
Sysprep
Sysprep is the name of Microsoft's System Preparation Utility for Microsoft Windows operating system deployment.- History :Sysprep was originally introduced for use with Windows NT 4.0. Later versions introduced for Windows 2000 and Windows XP are available for download from Microsoft and included...

. Sysprep rewrites system security codes to prevent disk security identifier
Security Identifier
In the context of the Microsoft Windows NT line of operating systems, a Security Identifier is a unique name which is assigned by a Windows Domain controller during the log on process that is used to identify a subject, such as a user or a group of users in a network of NT/2000...

duplication, but does not update scheduled tasks to use the new security. Consequently all SYSTEM scheduled tasks fail to run on the imaged computers. There is no solution for this problem, and it renders the task scheduler useless for administrative management of imaged computers, such as scheduling forced system shutdowns at night.

As from Task Scheduler 2.0, a new bug was introduced. The value in the Next Run Time field in Task Scheduler is incorrect in Windows Vista and in Windows Server 2008 (scheduled task doesn't stop running after repetition duration has expired)

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK