Export (0) Print
Expand All
Expand Minimize

Windows 2000 Task Scheduler

By Kathy Ivens , Kenton Gardinier

This article is from the January 2001 issue of Windows 2000 Magazine.

A new graphical way to schedule tasks

Windows 2000 includes Task Scheduler, a new graphical tool that you can use to run scripts or programs according to a schedule. The tool helps you create and customize scheduled tasks, then saves the tasks as .job files, which reside in \%systemroot%. You can schedule tasks to run locally, or you can email or copy .job files to remote computers to run scheduled tasks on those computers. Although Task Scheduler doesn't completely replace the At command, which you might be familiar with from Windows NT, Task Scheduler does offer a simpler, more efficient way to schedule tasks. Task Scheduler's advantages over the At command include easier administration, more configuration options (e.g., options to schedule tasks during logon, system startup, or idle time), and the ability to run tasks in different security contexts. (For information about the interaction of Task Scheduler and the At command, see the sidebar "What About the At Command?")

What About the At Command?

If you used the At command in Windows NT, you're familiar with the concept of scheduling programs. The At command is still available in Windows 2000, and you can use it to schedule tasks. However, several differences between the At command and Windows 2000's Task Scheduler make the new tool easier to use and configure. The most obvious advantage is Task Scheduler's graphical interface, but equally important are its flexibility, which lets you configure tasks to run in a variety of different security contexts, and its auditing capabilities. Task Scheduler is a COM-based object, which means you have a common API set.

The At command and Task Scheduler work together. When you use the At command to schedule a task, that task appears in the Scheduled Tasks window. To reconfigure the task, you can use At command switches or Task Scheduler features. However, after you use Task Scheduler to change a task's configuration, the At modifiers no longer work on that task—you've committed your modification efforts to Task Scheduler.

On This Page

Launching Task Scheduler
Using the Scheduled Task Wizard
Manually Creating a Scheduled Task
Working with Scheduled Tasks
Setting Global Options
Working with Remote Computers
Getting on Schedule

Launching Task Scheduler

Before you run Task Scheduler, be sure the computer's date and time settings are correct. To launch the utility, use the Control Panel Scheduled Tasks applet, or click Start, Programs, Accessories, System Tools, Scheduled Tasks, then double-click the Scheduled Tasks icon. The Scheduled Tasks window opens to display an Add Scheduled Task icon, as well as icons for any existing tasks. You can choose among three methods for creating a new task: Use the Scheduled Task Wizard; manually configure the task; or drag a program, script, or document into the Scheduled Tasks window.

Using the Scheduled Task Wizard

To launch the Scheduled Task Wizard, double-click the Add Scheduled Task icon. Click Next to move past the opening screen. The wizard presents a list of the application files on your computer; this list includes applications that you installed with the OS as well as any third-party software that appears in the Control Panel Add/Remove Programs applet. If the application you want to schedule isn't on the list, click Browse to open the Select Program to Schedule window. You can then select a local application or script, or you can browse through the network to select an object on a remote computer. After you select an object, click Next.

The next screen, which Figure 1 shows, prompts you to name the task and specify when you want it to run. The subsequent screen prompts you to enter a start time and other options specific to the task's frequency. (If you selected the When I log on or When my computer starts option, the wizard skips this screen.)

The next screen prompts you to enter a username and password; the task will run as if started by that user. The final screen offers the usual Finish button but also includes an option to automatically open the created task's Properties dialog box when you click Finish.

Bb742547.tsksch01(en-us,TechNet.10).gif

Figure 1: The Scheduled Task Wizard

Manually Creating a Scheduled Task

After you're familiar with Task Scheduler, manually creating a task is often faster than using the wizard. The manual process also lets you move among settings to fine-tune the task. Instead of stepping through the wizard, you can manually create a task, then leap directly to the task's Properties dialog box to configure the task. This manual procedure also applies to dragging an application or script into the Scheduled Tasks window; the only difference is that dragging the application or script into the window creates the new scheduled task.

To create a task, open the Scheduled Tasks window, then click File, New, Scheduled Task. (You can also right-click a blank spot in the Scheduled Tasks window and choose New, Scheduled Task.) A New Task icon appears. The title is in Edit mode so that you can immediately enter a name for the new task. Right-click the task icon, and click Properties to open the task's Properties dialog box. The Properties dialog box contains four tabs, which offer several options for manually configuring the task.

The Task tab . On the Task tab, which Figure 2 shows, enter the name and path of the application you want to run. If any part of the path contains spaces, enclose the entire path in quotation marks. If the scheduled task is an executable file, you can add parameters you want to run with the program. Next, enter the user under which the task will run. You can also disable the task from this tab; to do so, clear the Enabled (scheduled task runs at specified time) check box.

Bb742547.tsksch02(en-us,TechNet.10).gif

Figure 2: Manually configuring a new task

The Schedule tab . On the Schedule tab, specify the task's frequency. Note that a difference exists between the options on this tab and those in the wizard. When you choose to run a task Daily, the wizard offers a Weekdays option; the Properties dialog box doesn't. If you want to run a manually configured task only on weekdays, you must select Weekly on the Schedule tab, then select individual days. To fine-tune the schedule, click Advanced; the advanced options differ depending on the schedule frequency (e.g., Daily, Weekly) that you choose.

The Settings tab . The Settings tab, which Figure 3 shows, offers options to control task operation under certain system conditions. Under Scheduled Task Completed, you can select the Delete the task if it is not scheduled to run again check box for tasks that have an end date or that run only once. When you select this option, Task Scheduler removes the job after the last automatic occurrence. Don't select this option if you might reincarnate the task. The Stop the task if it runs for option lets you end the task after a specified time (the default is 72 hours). This option is useful for time-consuming middle-of-the-night operations that must finish before the business day begins. Because the default allowance is overly generous for most tasks, you should configure the time to suit the operation's needs rather than accept the default.

Bb742547.tsksch03(en-us,TechNet.10).gif

Figure 3: Configuring a task's behavior

Under Idle Time, you can specify options for a task that you configured to execute during idle time (i.e., time during which no mouse or keyboard activity occurs on the target system). Of course, no mouse or keyboard activity doesn't mean a computer is idle; all sorts of activities could be happening, including downloads, database searches, or other automated tasks. Keep this caveat in mind when you schedule tasks: You probably don't want several I/O- or processor-intensive tasks running at the same time unless you're prepared to let them run longer than they typically would individually. The Idle Time options don't necessarily make scheduled tasks run more efficiently.

Under Power Management, you can specify a task's behavior if battery-power problems arise when the task is scheduled to run or is already running. This option applies to laptops rather than computers that switch over to a UPS during electrical power loss. (UPS software such as American Power Conversion's—APC's—PowerChute usually configures all programs, including automated tasks, for shutdown in such an event.) An option to Wake the computer to run this task appears for computers that support that feature.

Bb742547.tsksch04(en-us,TechNet.10).gif

Figure 4: Setting permissions for a task

The Security tab . On the Security tab, which Figure 4 shows, you can specify the users who can view, delete, modify, or use a task. (Table 1 describes the available permission levels.) Task Scheduler bases task security on standard Windows 2000 security permissions. Remember that the program, script, or document that the task runs might also have security restrictions if the target computer runs NTFS. Be careful not to create a conflict between these security levels.

Table 1 Permissions for Managing Scheduled Tasks

Permission Level

Rights

Full Control

View, run, change, delete, change owner

Modify

View, run, change, delete

Read & Execute

View, run

Read

View

Write

View, run, change, delete

To configure advanced security options for the task, click Advanced. The Access Control Settings dialog box, which Figure 5 shows, presents options for granular control over permissions, auditing, and ownership.

Bb742547.tsksch05(en-us,TechNet.10).gif

Figure 5: Advanced security options

Working with Scheduled Tasks

After you create and configure a task, you might want to modify it or check its status. Task Scheduler offers several options for working with existing tasks.

Start and stop scheduled tasks . You can run any task at any time rather than wait for the next scheduled occurrence. To start a task, open the Scheduled Tasks window, select the task, and choose File, Run from the menu bar. (You can also right-click the task, then click Run.) To stop a running task, right-click the task, then click End Task. The message might take a moment to reach the task.

Bb742547.tsksch06(en-us,TechNet.10).gif

Figure 6: Scheduled Tasks' Details view

Check the status of scheduled tasks . To obtain information about a task's status, select the Details view of the Scheduled Tasks window. Figure 6 shows this view; Table 2 explains the notations that can appear in the view's Status column. You can also check the log file to see detailed information about tasks' performance. To access the log file, open the Scheduled Tasks window and choose Advanced, View Log from the menu bar. You can also open the log manually from Notepad. The log file is \%systemroot%\schedlgu.txt.

Table 2 Status Column Notations

Notation

Meaning

Could not start

The most recent attempt to start the task failed.

Empty

The task isn't running.

 

The task has run successfully.

Missed

One or more attempts to run this task were missed.

Running

The task is running.

Modify scheduled tasks . To change properties for an existing task, open the Scheduled Tasks window, and select the task. Then, open the task's Properties dialog box and make the needed changes.

Delete scheduled tasks . To delete a scheduled task, open the Scheduled Tasks window and select the task. Then, press the Del key, click the Delete icon on the toolbar, or choose File, Delete from the menu bar. (You can also right-click the task and select Delete from the shortcut menu.) Task Scheduler sends deleted tasks to the Recycle Bin. If you don't want a task to run but think you might want to use the task later, disable the task instead of deleting it.

Setting Global Options

Task Scheduler's Advanced menu offers options for manipulating the way scheduled tasks operate. To access this menu, open the Scheduled Tasks window and click Advanced from the menu bar. Then, choose from the following options.

Stop Using Task Scheduler . Select Stop Using Task Scheduler to disable all scheduled tasks and prevent Task Scheduler from running automatically when you start Windows 2000. To return Task Scheduler to normal operation, select Start Using Task Scheduler.

Pause Task Scheduler . Select Pause Task Scheduler to temporarily halt running tasks and to prevent scheduled tasks from starting. This command is useful for stopping tasks while you install software. To resume scheduled tasks, select Continue Task Scheduler. Any tasks scheduled to run while Pause Task Scheduler was active will run at the next scheduled time.

Notify Me of Missed Tasks . Contrary to its name, the Notify Me of Missed Tasks option notifies you only of Task Scheduler's failure, not of individual missed tasks. Tasks that fail to run because of corrupt or missing executables don't kick off a notification.

AT Service Account . Select AT Service Account to change the user account under which tasks scheduled with the At command will run. (The default account is System.) Selecting this option opens the AT Service Account Configuration dialog box. To change the account, select This Account, enter a user account, and enter and confirm the password for that account.

View Log . Select View Log to open the task log in Notepad. You can then use the log to track the success or failure of your scheduled tasks.

Working with Remote Computers

If you have the appropriate permissions, you can delete or modify jobs on a remote computer. Even if you don't have permission to access tasks on another computer, you can send tasks to someone who does have those permissions.

Viewing and modifying remote tasks . When you work with tasks on remote computers, you need to understand the difference between the remote computer's Scheduled Tasks folder and the Tasks folder in the remote computer's \%systemroot% folder. The Scheduled Tasks folder can be misleading.

When you view a remote computer in My Network Places, Windows Explorer, or My Computer (by using the Folders view), you'll see a folder named Scheduled Tasks. If you select that folder, the contents will look familiar because you're actually looking at the contents of your local machine's \%systemroot%tasks folder. If you delete a job from the remote computer's Scheduled Tasks folder, you're actually deleting it from your computer's Tasks folder. The system won't let you drag jobs between your Tasks folder and the phantom remote Scheduled Tasks folder because you can't drag a job to itself.

To view another computer's Tasks folder, you must expand the remote computer's \%systemroot% folder and select Tasks. Use the Details view to get the most information. The \%systemroot%tasks folder can't be shared, so to access the remote Tasks folder, you must have access permissions either on the \%systemroot% folder or on the drive.

When you can access the target computer's Tasks folder, you can drag or copy a task from your computer to the remote machine. The quickest method is to right-click then drag the task from your local Tasks folder to the remote Tasks folder. (If you left-click and drag, you'll move the job instead of copy it.) Choose Copy Here from the menu that appears when you release the right mouse button. Alternatively, you can use the Copy and Paste commands to copy jobs between folders.

If you can't access the remote computer's Tasks folder, you can place the job outside the \%systemroot% folder on the target computer. Then, you can let that machine's user move the file into the Tasks folder.

Using email to send and receive tasks . You can email a task file (i.e., taskname.job) as a standard email attachment. The recipient can then drag or copy the file to the target computer's Tasks folder.

The file on which the job depends (e.g., an executable or document file) must exist on the target computer. You might also need to adjust the job's properties to reflect the application file's path on the remote computer.

Getting on Schedule

Windows 2000's Task Scheduler provides a quick and efficient way to automate routine tasks. The tool's ability to save these tasks as files in \%systemroot% gives you plenty of options (e.g., run the tasks locally, email the tasks to remote computers).

Task Scheduler doesn't replace the At command; rather, the new tool builds on the At command's functionality and simplifies task scheduling. (To learn more about the At command in NT, see Mark Minasi, Inside Out, "Where It's AT," March 1998.)

Take advantage of this new tool's extensive configuration options. Then you can watch your scheduled tasks run like clockwork.

About the Author

Kathy Ivens is a contributing editor for Windows 2000 Magazine and the author or co-author of more than 40 computer books, including Windows 2000: The Complete Reference (Osborne/McGraw-Hill). You can reach her at kivens@win2000mag.com. Kenton Gardinier is chief of technology for TASK, specializing in performance analysis and optimization of Windows 2000 and Windows NT networks. He is an MCSE and coauthor of Windows 2000: The Complete Reference. You can reach him at Kenton@task-group.com.

The above article is courtesy of Windows 2000 Magazine. Click here to subscribe to Windows 2000 Magazine.

We at Microsoft Corporation hope that the information in this work is valuable to you. Your use of the information contained in this work, however, is at your sole risk. All information in this work is provided "as -is", without any warranty, whether express or implied, of its accuracy, completeness, fitness for a particular purpose, title or non-infringement, and none of the third-party products or information mentioned in the work are authored, recommended, supported or guaranteed by Microsoft Corporation. Microsoft Corporation shall not be liable for any damages you may sustain by using this information, whether direct, indirect, special, incidental or consequential, even if it has been advised of the possibility of such damages. All prices for products mentioned in this document are subject to change without notice.

Link
Click to order


Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft