Scheduling Tasks with the Scheduled Task Wizard

 < Day Day Up > 



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

Entries in the Scheduled Tasks folder show currently scheduled tasks. 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 click Control Panel, and then click Scheduled Tasks.

In a Windows domain, 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.

In a workgroup, establish a Remote Desktop connection as discussed previously, then use Windows Explorer to access the Scheduled Tasks folder. You can also use this technique for computers in a domain, but the procedure described previously is more convenient.

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 page, and then click Next.

  2. Using the page shown in Figure 4-2, select a program to schedule by clicking Browse to open the Select Program To Schedule dialog box and then use the dialog box to find the program, command-line utility, or script that you want to run. Afterward, click Open.

    click to expand
    Figure 4-2: Use the Scheduled Task Wizard to select a program to run, and then click Browse to find scripts and other applications.

  3. Type a name for the task, as shown in Figure 4-3. The name should be short but descriptive so you can quickly determine what the task does.

    click to expand
    Figure 4-3: Use the Scheduled Task Wizard to name a task, and then select how often you’d like to perform this task.

  4. 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.

  5. Click Next. If a period is to be scheduled, select a date and time to run the scheduled task. The next page you see depends on when the task is scheduled to run.

  6. If you’ve selected a daily running task, the date and time page appears as shown in Figure 4-4.

    click to expand
    Figure 4-4: Use this page to configure a daily scheduled task.

    Set a start time and date. Daily scheduled tasks can be configured to run

    • Every Day—Seven days a week.

    • Weekdays—Monday through Friday only.

    • Every ... Days—Every 2, 3, ... N days.

  7. If you’ve selected a weekly running task, the date and time page appears as shown in Figure 4-5.

    click to expand
    Figure 4-5: Use this page to configure a weekly scheduled task.

    Configure the task using these fields:

    • Start Time—Sets the start time of the task.

    • Every ... Weeks—Allows you to run the task every week, every two weeks, or every N weeks.

    • Select The Day(s) Of The Week Below—Sets the day(s) of the week when the task runs, such as on Monday or on Monday and Friday.

  8. If you’ve selected a monthly running task, the date and time page appears as shown in Figure 4-6.

    click to expand
    Figure 4-6: Use this page to configure a monthly scheduled task.

    Configure the task using these fields:

    • Start Time—Sets the start time of the task.

    • Day—Sets the day of the month the task runs. For example, if you select 5, the task runs on the fifth day of the month.

    • The ...—Sets task to run on the Nth occurrence of a day in a month, such as the second Monday or the third Tuesday of every month.

    • Of The Month(s)—These check boxes let you select the months in which the task runs.

  9. If you’ve selected One Time Only for running the task, the date and time page appears as shown in Figure 4-7. Set the start time and start date.

    click to expand
    Figure 4-7: Use this page to configure a one-time-only scheduled task.

    Tip

    With tasks that run automatically when the computer starts or when the task’s user logs on, you don’t have to set the start date and time. If you want to configure a startup task for a specific user through the wizard, you’ll need to log on as that user and then run the wizard.

  10. After you’ve configured a start date and time, click Next to continue.

  11. In the next dialog box, type a user name and password that can be used when running the scheduled task. This user name must have appropriate permissions and privileges to run the scheduled task.

    Note

    In Windows domains, be sure to enter the user name in the form: Domain\UserName, such as Adatum\wrstanek, where Adatum is the domain and wrstanek is the user account.

  12. The final wizard page provides a summary of the task you’re scheduling as follows:

    • If you want to set command-line arguments, select Open Advanced Properties For This Task When I Click Finish, or double-click the task in Windows Explorer after clicking Finish. Then, in the Run field, type the parameters after the task path. If the task path includes spaces, be sure to enclose the path in double quotation marks (“). Likewise, if a command-line argument includes spaces, enclose the argument in double quotation marks (“).

    • If an error occurs when you create the task, you’ll see an error prompt. Click OK. The task should still be created. You may, however, need to edit the task’s properties. In Windows Explorer, double-click the task to correct the specified error. One of the more common errors you’ll see is Access Denied. This error can occur if the user credentials provided are incorrect, such as occurs if you enter the wrong password or the user account doesn’t exist in the domain.

    Click Finish to complete the scheduling process.

Real World

Many problems with getting tasks to run are fairly obvious. For example, any task listed as “Could not start” should be examined. Sometimes, however problems with tasks aren’t so clear. A task that is listed as “Running” may not in fact be running and instead may be a hung process. To check for hung processes, use the Last Run Time; it tells you when the task was started. If the task has been running for more than a day, there is usually a problem. A script may be waiting for input, it may have problems reading or writing files, or it may simply be a runaway task that needs to be stopped. To stop the task, right-click the task in the Scheduled Tasks folder, then select End Task. You can also wait for the system to stop the task. By default, all tasks time out after running for 72 hours. You can change the timeout using the Settings tab of the task’s Properties dialog box.

Changing Task Properties

To change the settings for a task, access the Scheduled Tasks folder. On a local system, double-click Scheduled Tasks in the Control Panel. On a remote system, start Windows Explorer, use the My Network Places node to navigate to the computer you want to work with, click the computer’s icon, and then click Scheduled Tasks. Next, double-click the task you want to work with and then use the Properties dialog box to make the necessary changes.

Note

If you change the way a task runs, you may be prompted to set the account information. In this case, you will need to accept the current account the task is configured to run as, or enter a new account in Domain\UserName format. Either way, you will need to enter and confirm the password for the account you’ve used.

Copying and Moving Tasks from One System to Another

If you want to take tasks created on one system and use them on another system, you don’t have to recreate them manually. Instead, in a domain, follow this procedure:

  1. Use the My Network Places node to navigate to the computer where the tasks you want to use are currently stored. Click the computer’s icon and then click Scheduled Tasks.

  2. Right-click one of the tasks you want to use, and then select Copy.

  3. Again, use the My Network Places node to navigate through the organization. This time, navigate to the computer on which you want to use the task.

  4. With the destination computer’s icon selected, right-click Scheduled Tasks and then select Paste.

  5. The scheduled task should be copied to the new location. Be sure to check the properties of the task on the destination computer, making sure the settings are suitable.

You can also move tasks from one computer to another. To move tasks in a domain, follow these steps:

  1. Use the My Network Places node to navigate to the computer where the tasks you want to use are currently stored. Click the computer’s icon and then click Scheduled Tasks.

  2. Right-click one of the tasks you want to use, and then select Cut.

  3. Again, use the My Network Places node to navigate through the organization. This time, navigate to the computer to which you want to move the task.

  4. With the destination computer’s icon selected, right-click Scheduled Tasks and then select Paste.

  5. The scheduled task should be moved to the new location. Be sure to check the properties of the task on the destination computer, making sure the settings are suitable.

Enabling and Disabling Tasks

Tasks can be enabled or disabled as needed, depending on your preference. If you temporarily don’t want to use a task, you can disable it. When you are ready to use the task again, you can enable it. By enabling and disabling tasks rather than deleting them, you save the time involved in reconfiguring task settings.

You can enable or disable a task by following these steps:

  1. Access the Scheduled Tasks folder. On a local system, select or double-click Scheduled Tasks in the Control Panel. On a remote system, start Windows Explorer, use the My Network Places node to navigate to the computer you want to work with, click the computer’s icon, and then click Scheduled Tasks.

  2. Select or double-click the task you want to modify. This displays a Properties dialog box that is named for the task in question. The Task tab should be selected by default.

  3. Select Enabled to enable the task or clear Enabled to disable the task. Click OK.

Running Tasks Immediately

You don’t have to wait for the scheduled time to run a task. To run a task at any time, access the Scheduled Tasks folder, right-click the task you want to run, and then select Run.

Removing Unwanted Tasks

If you no longer need a task, you can delete it permanently by accessing the Scheduled Tasks folder, right-clicking the task you want to delete, and then selecting Delete.



 < Day Day Up > 



Microsoft Windows Command-Line Administrator's Pocket Consultant
MicrosoftВ® WindowsВ® Command-Line Administrators Pocket Consultant
ISBN: 0735620385
EAN: 2147483647
Year: 2004
Pages: 114

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