The Task Scheduler

Abstract

This paper is intended for software developers and system integrators. It describes the Task Scheduler, a new service and user interface that runs on the Microsoft Windows® operating systems.

On This Page

Introduction A Common, Flexible, and Extensible Interface Why Should Developers Be Interested? So, How Do I Get It? Summary Additional Information

Introduction

Why Do We Need Another Scheduler?

Every new system or application offers some kind of scheduling service, something that automatically invokes scripts or programs at specified times. The most common, and in many ways the least useful, is the StartUp program group, present in all of the Windows operating systems. The problem with the StartUp group and all the other schedulers is that they are all designed for different needs and are rarely built to integrate with all the components in a system, or work seamlessly in more than one system. The Windows 95 Plus! Pack provided the System Agent which included a user interface as well as a set of application programming interfaces (APIs). Microsoft Windows NT® came with the AT command, not an especially user-friendly tool that required a fair amount of familiarity with the arcane world of the command prompt. Many applications provide a place for users to configure some scheduling mechanism for performing recurring, necessary maintenance tasks. None of these schedulers work well together, and few provide any programmable interfaces.

A Common, Flexible, and Extensible Interface

Task Scheduler provides a friendly user interface1 that is the same one on both Windows and Windows NT, with the exception of added security features in Windows NT and Windows 2000. The interface is fully integrated into the operating system, and is accessible from the My Computer icon on your desktop. Users can drag-and-drop programs right into Task Scheduler to quickly add a new task or use the provided "Create Scheduled Task" wizard.

Figure 1: Task Scheduler Main Window

Figure 1: Task Scheduler Main Window

You can schedule any script, program, or document to be invoked at any time or any interval, every day to once a year, and on events like system boot, user logon, or system idle. A task is saved as a file with a .job extension, which enhances the ability to move from computer to computer. Administrators can create scheduled maintenance task files and place them where needed. You can access the Task Folder remotely from the Network Neighborhood as well as send tasks in e-mail.

On Windows NT and Windows 2000, scheduled tasks are created and executed based on standard security permissions. Tasks are persisted as files and are configurable by NTFS access control lists (ACLs) to set who can view, delete, modify, or use them. The items that make up the task, the scripts, programs, and documents, are also still controlled by whatever ACLs are present. Under Windows NT and Windows 2000, this provides a high degree of control over how files are accessed.

Note: When you move a .job file on a Windows NT or Windows 2000-based system, a user's credentials will not transfer with the file. They must be reentered after moving the file. This is because the credentials are not stored with the task, but by the security system of the operating system.

Since Windows NT and Windows 2000 are multiuser environments, when tasks are created, a user name and password are required that will set the current security context in which the task will execute. This allows multiple tasks to run on a single computer in the security context that was supplied. Multiple users can each have their own individual scheduled tasks.

Why Should Developers Be Interested?

Task Scheduler provides a common and fully programmable set of interfaces. Task Scheduler is a COM-based object, which adds all the advantages of COM, including language and platform independence (as well as remote capabilities provided by DCOM). If you are developing an application to run under both Windows and Windows NT, you can write to the same interfaces regardless of the platform.

All of the functionality in Task Scheduler is completely accessible from these APIs. This means you don't have to "rewrite the wheel" when you want to add scheduling services to your applications. You can be assured that the scheduling services will already be there in the operating system and that they'll be robust, stable, and, over subsequent releases, more feature-rich.

Finally, with Task Scheduler you don't even have to write your own scheduling property pages. You can invoke Task Scheduler's property pages from the same APIs. You can create the property pages and dialog boxes that are specific to your application and then invoke Task Scheduler's property pages as needed.

Bb742545.tasksc02(en-us,TechNet.10).gif

Figure 2: One of Task Scheduler's Property Pages

So, How Do I Get It?

The Task Scheduler user interface is available at the Platform SDK at https://www.microsoft.com/msdn/sdk.

Summary

The goal of the Task Scheduler team is to unify a set of disparate tools to make a user's experience more consistent and satisfying. By providing common APIs across platforms, Microsoft hopes to help developers in building their applications and adding scheduling services–virtually for free. Robust, cross-platform, flexible scheduling is one less thing you have to create from scratch.

Additional Information

For the latest information on Windows, check out Microsoft TechNet or the Windows website.

For the latest information on Windows NT Server, check out the website at https://www.microsoft.com/ntserver or the Windows NT Server Forum on the Microsoft Network (GO WORD: MSNTS).

1 The item that is different at this time is that Win9X has an idle trigger. This will be the same with the release of Windows