Scheduling Tasks


Scheduling Tasks

When you manage systems, you'll often want to perform tasks such as updates or maintenance during nonbusiness hours. This way, you don't affect productivity and workflow. But who wants to come in at 3 a.m. on a Monday morning? Fortunately, using the Task Scheduler service, you can schedule one-time or recurring tasks to run automatically at any hour of the day or night.

You automate tasks by running command-shell scripts, WSH scripts, or applications that execute the necessary commands for you. For example, if you wanted to back up the system drive every weekday at midnight, you could create a script that runs backups for you and records progress and success/failure in a log file.

Utilities for Scheduling Tasks

In Windows Server 2003, you can schedule tasks on local and remote systems using the Scheduled Task Wizard, the command-line AT utility, or the command-line SCHTASK utility. Each utility has its advantages and disadvantages.

Scheduled Task Wizard provides a point-and-click interface to task assignment. This makes it easy to quickly configure tasks without having to worry about syntax issues. The disadvantage is that you don't have a central location that you can use to check for scheduled tasks throughout the enterprise and you have to access the wizard separately on each individual system that you want to configure.

The command-line AT scheduler, on the other hand, doesn't have a friendly point-and-click interface. This means you'll have to learn the necessary command syntax and type in commands. The advantage to AT is that you can designate a single server as a task scheduler and you can view and set tasks throughout the enterprise on this single server.

SCHTASKS is a command-line utility that is just as versatile as the Scheduled Task Wizard. You can use the utility to configure tasks to run on a specific schedule, set run permissions, and configure startup, log on, and idle processor commands. Like AT, you can also schedule tasks to run anywhere on the network. More important, SCHTASKS can be used to view status information for any scheduled tasks that are configured on a system, including those created using AT, SCHTASKS itself, and the Scheduled Task Wizard.

The sections that follow discuss how to use the Scheduled Task Wizard. A complete discussion of AT and SCHTASKS is beyond the scope of this book. However, if you want to use SCHTASKS to examine scheduled tasks configured on any system on the network, simply type the following command at a command prompt:

schtasks /query /s SystemName

where SystemName is the name of the system that you want to examine, such as:

schtasks /query /s corpserver01

Preparing to Schedule Tasks

The Windows Server 2003 service that controls task scheduling is the Task Scheduler service. Task Scheduler logs on as the LocalSystem account by default. This account usually doesn't have adequate permissions to perform administrative tasks. Because of this, when you use the AT scheduler, you should configure Task Scheduler to use a specific user account that has adequate user privileges and access rights to run the tasks you want to schedule.

You should also make sure that the Task Scheduler service is configured to start automatically on all the systems on which you want to schedule tasks. Set the Task Scheduler startup and logon account as specified in the sections entitled "Configuring Service Startup" and "Configuring Service Logon" in Chapter 3 , "Monitoring Processes, Services, and Events."

A script should configure whatever user settings are necessary. This ensures that everything the script does is under its control and that domain user settings, such as drive mappings, are available as necessary.

Scheduling Tasks with the Scheduled Task Wizard

You can use the Scheduled Task Wizard to schedule tasks on the local or remote system to which you're currently connected. You access the Scheduled Task Wizard and currently scheduled tasks through the Scheduled Tasks folder.

Accessing the Scheduled Tasks Folder

You can access the Scheduled Tasks folder on a local system with either of the following techniques:

  • Start Control Panel and then click Scheduled Tasks.

  • Start Windows Explorer, click My Computer, then Control Panel, and then Scheduled Tasks.

You can access the Scheduled Tasks folder on a remote system by completing the following steps:

  1. Start Windows Explorer, and then use the My Network Places node to navigate to the computer you want to work with.

  2. Click the computer's icon and then click Scheduled Tasks.

  3. To create scheduled tasks on remote computers, right-click in the details pane to display a shortcut menu. Point to New and then select Scheduled Task. You then configure the scheduled task using a properties dialog box rather than the Scheduled Task Wizard.

Viewing and Managing Existing Tasks

Entries in the Scheduled Tasks folder show currently scheduled tasks. You can work with entries in the Scheduled Tasks folder using any of the following techniques:

  • Double-click Add Scheduled Task to start the Scheduled Task Wizard. This option is not available on a remote system. However, you could create the task locally using the wizard and then copy the scheduled task to the Scheduled Tasks folder on the remote system.

  • Double-click an existing task entry to view or change its properties. You can set advanced options through the Settings tab.

  • Select a task entry and press Delete to delete the task.

Creating Tasks with the Scheduled Task Wizard

To schedule a task with the Scheduled Task Wizard, follow these steps:

  1. Start the Scheduled Task Wizard by double-clicking Add Scheduled Task in the Scheduled Tasks folder. Read the welcome dialog box and then click Next .

  2. Using the page shown in Figure 4-11, select a program to schedule. The page shows key applications registered on the system, such as Disk Cleanup and Synchronize. The page doesn't show available scripts, however.

    Figure 4-11. Use the Scheduled Task Wizard to select a program to run. Click Browse to find scripts and other applications.

    graphics/f04ap11.jpg

  3. Click Browse to open the Select Program To Schedule dialog box. Use the dialog box to find a command-shell or WSH script you want to run.

  4. Type a name for the task. The name should be short but descriptive so you can quickly determine what the task does.

  5. Select a run schedule for the task. Tasks can be scheduled to run periodically (daily, weekly, or monthly), or when a specific event occurs, such as when the computer starts or when the task's user logs on.

  6. Click Next and then select a date and time to run the scheduled task. The next dialog box you see depends on when the task is scheduled to run.

  7. After you've configured a start date and time, click Next to continue. Then type a username and password that can be used when running the scheduled task. This username must have appropriate permissions and privileges to run the scheduled task.

  8. The final wizard page provides a summary of the task you're scheduling. Click Finish to complete the scheduling process. If an error occurs when you create the task, you'll see an error prompt. Click OK. The task should still be created. Afterward, in Windows Explorer double-click the task to correct the problem in the related properties dialog box.



Microsoft Windows Server 2003 Administrator[ap]s Pocket Consultant
Microsoft Windows Server 2003 Administrator[ap]s Pocket Consultant
ISBN: 735622450
EAN: N/A
Year: 2003
Pages: 141

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net