Search
Windows 7

Using the Windows 7 Task Scheduler (part 1)

Published 5 min readBy Programming4us Editorial Team
The Windows 7 Task Scheduler, which requires no programming expertise, is probably the most important automation tool at your disposal. You can use it to set up automated routines, to be triggered by events or by a schedule. In addition to running programs or scripts at specified times, you can launch actions when the computer has been idle for a specified time period, when particular users log on or off, and so on. You can use these (and other) triggers to send e-mail messages or display message windows, as well as to run programs or scripts. The Scheduled Tasks snap-in has been neatly integrated with the Event Viewer snap-in, making it easy for you to use events (an application crash or a disk-full error, for example) as triggers for tasks.

Task Scheduler is implemented as an MMC snap-in; to run it, you can go to Control Panel, click System And Security, and then click Schedule Tasks, which you'll find under Administrative Tools, at the bottom of the window. If you have an Administrative Tools folder on your Start menu, you can find Task Scheduler there. Or, more simply, type task in the Start menu search box; Task Scheduler will appear at or near the top of the search results.

As Figure 1 shows, Task Scheduler in its default layout is divided vertically into three regions—a console tree on the left, an action pane on the right, and in between, various informative windows in the details pane. The console tree shows you which computer you're working with (the local machine or a network computer to which you have connected) and provides a folder tree of currently defined tasks. You can create your own folders here to organize the tasks that you create yourself, or you can add new tasks to existing folders.

The action pane provides a menu of things you can do. With rare exceptions, items here are also available on the menus at the top of the window, so if you're feeling cramped in the center, you might consider hiding the action pane.

In the center part of the window, initially, you'll see an overview message (you can hide this static bit of text, as we have done in Figure 1, by clicking the collapse arrow at the right), a status report of all tasks that have run (or were scheduled to run) during some period of time (by default, the most recent 24 hours), and a summary of all the currently enabled tasks.

Figure 1. The Active Tasks section of the details pane shows what tasks are currently enabled and when they will next run.


The Task Status and Active Tasks displays are not updated automatically. To get the latest information, click Refresh—at the bottom of the screen, in the action pane, or on the Action menu.

If this is your first visit to Task Scheduler, you might be surprised by the number of active tasks that Windows and your applications have already established. For example, if you use the Windows 7 Backup program to perform regular full and incremental backups, you'll find some Backup-related items in the list. Unless you or someone else has disabled automatic disk defragmentation, there will be an item for it in the list. If you use a calendar program to remind you of appointments or task deadlines, chances are that functionality will be represented in the Active Tasks list. To see what tasks managed by Task Scheduler are currently running, click Display All Running Tasks in the action pane.

To satisfy your curiosity about what an active task does and how it has been set up, you'll need to locate it in the console tree. Expand the outline entries as needed and browse to an item of interest. The entries in the console tree are virtual folders, each of which can contain subfolders of one or more tasks. When you select a folder, the upper part of the details pane lists all tasks stored in the folder. The lower pane, meanwhile, shows a tabbed display of the properties of the selected task. Figure 2 shows the RAC folder selected in the console tree, the RacTask task selected in the upper pane, and the General tab of the RacTask properties display in the lower pane. (This task generates system reliability data.)

Figure 2. Selecting a folder in the console tree produces a list of that folder's tasks in the upper part of the details pane and a properties display in the lower part.


The properties display that appears in the Task Scheduler details pane is read-only. To edit the properties associated with a task, right-click the task name and choose Properties from the shortcut menu. (Or double-click the task's entry.) That will open a read-write dialog box in a separate window.

With the exception of the History tab, the properties dialog box is identical to the Create Task dialog box, one of the tools you can use to create a new task. The History tab allows you to see exactly how, whether, and when a task has run. Figure 3 shows the History tab for RacTask.

Figure 3. The History tab lets you confirm that a scheduled task has run as expected.


When you display the History tab, the relevant portion of the Event Viewer snap-in snaps in, showing you all the recent events relating to the selected task. This is exactly what you would see if you ran Eventvwr.msc, navigated in the console tree to Applications And Services Logs\Microsoft\Windows\TaskScheduler\Operational, and filtered the resulting log display to show events relating to the selected task. (Obviously, if you want this information, it's quicker to find it in the Task Scheduler console than in the Event Viewer console.) If a task you've set up is not getting triggered when you expect it to or not running successfully when it should, you can double-click the appropriate event entry and read whatever details the event log has to offer.