Recently, we've covered how to create a basic task using Task Scheduler's 4-steps wizard. Now it is time to address the topic of creating advanced tasks, for those of you who want to have maximum control. Task Scheduler is one of the most powerful tools that Windows 7 has to offer so, be prepared for a large range of choices which allow you to set up every possible detail about a task.
Finding the Create Task Button
Open the Task Scheduler application. To learn how to do this, check out first steps in working with Task Scheduler.
To create a new task, go to the Actions panel and, on the right hand side, click on 'Create Task'.
The pane that opens is similar to those which show the properties of a task, explained in this tutorial: First Steps in Working With Task Scheduler.
From here you can set up every detail about your new task, starting with its name, continuing with setting one or multiple triggers, actions, establishing conditions for running the task, etc. I will discuss every one of these tabs and present all the available options, together with a few usage examples.
Set the Task's Name, Description & Security Options
The first tab in the 'Create Task' window is named General. Here you can set up the name of the task and its description. Unlike the 'Create Basic Task' wizard, you can also configure some additional 'Security options' like when and how to run the task. By default, the user account set to be used when running the task, is the one you use to create the task. If you want to use another user account when running the task, click the 'Change User or Group' button.
You can choose if the task is run only when the user is logged on or if this doesn't matter. For example, tasks like Disk Cleanup can be set to run even when the user is not logged on. Choose the option you prefer.
If your task needs administrator permissions, don't forget to mark the check-box 'Run with highest privileges'.
Mark the Hidden box if you don't want the task to be visible. This means that the logged user will not be notified when the task is started or ended.
We are done with the 'general' properties. Next, let's look at triggers.
Set the Task's Triggers
Unlike with the 'Create Basic Task' wizard, you can set multiple triggers. To do this, click the Triggers tab.
To add a new trigger, click the New button.
The first trigger setting is to select when to begin the task. Click the 'Begin the task' drop-down box and choose one of the available options.
This task creator offers a few additional triggers compared to the 'Create Basic Task' wizard, such as: 'At task creation/modification', 'On connection to user session', 'On disconnect from user session', 'On workstation lock' and 'On workstation unlock'. Based on what you choose, you will be required to set different things in the Settings pane. The 'Advanced settings' remain the same indifferent of the trigger you choose.
For the triggers 'On connection to user session' and 'On disconnect from user session', you can make the following settings:
- Establish if connection to user session refers to any user or a specific user. The default is current user. However, you can press the 'Change User' button to choose another user.
- Establish if connection refers to a connection from a remote or local computer.
For the triggers 'On workstation lock' and 'On workstation unlock', set if this refers to any user or to a specific user. By default, the specific user is the current one. Press 'Change User' to select another user.
The 'Advanced settings' are common for all the triggers. For all the options, you must first check the corresponding box to see the list of available choices. You can make the following settings:
- Delay a task for a certain time: 30 seconds, 1 minute, 15 minutes, 30 minutes, 1 hour, 8 hours or 1 day;
- Choose the time interval after which the task is repeated (5, 10, 15, 30 minutes or 1 hour) and the duration of the repeat (15 or 30 minutes, 1 or 12 hours, 1 day or indefinitely);
- If your task, for some reason, might run longer than a time period you specify (30 minutes, 1, 2, 4, 8 or 12 hours or 1 or 3 days), you can choose to have it stopped automatically;
- You can set an activation and expiration date and time. This means the dates when the task will be run, if the trigger you specify is met;
- You can enable or disable the task.
Press OK when you have finished the settings for this trigger. Your new trigger is displayed in the list of triggers. You can create a new one, or select an existing trigger to edit or delete.
Set the Task's Actions
You can set more actions to a task. Go to the Actions tab and press the New button.
Choose one of the actions that the task must perform, by clicking on the drop-down box. You can select from: starting a program, sending an e-mail or displaying a message.
If you choose to start a program, click Browse and select the application to be started. Then, if needed, complete the optional fields called Arguments and Start in. If you want to send an e-mail, complete the fields From and To, set a subject, write the e-mail's text, add any attachments and specify the SMTP server (found in the properties of your e-mail account). For displaying a message, specify the title and the message.
As I have mentioned previously, you can create multiple actions for a task. For example, you can create a task that will run Disk Cleanup and send an e-mail notification that the process has started. You can change the order of the actions by clicking the buttons found on the right-hand side of the actions list.
To modify a task, select it and press Edit. To remove it, click the Delete button.
Set up the Conditions for Running the Task
Apart from the trigger, you can specify several conditions for when the task is run, based on: idle time passed, computer power or network that must be true, etc. To set them, click on the Conditions tab.
If you want your task not to interfere with your work, you can set it to run only when the computer is idle. Click the check-box 'Start the task only if the computer is idle for', and choose one of the available time periods. From the time you have set the task to start, you can choose to wait for the computer to switch into idle state or 'Don't wait for idle'. Once the computer is not on idle state, you can decide to stop the task, and restart it if the idle state resumes. As a possible usage scenario, these idle options are useful when you know that your task might require a lot of memory. In this case, you will not be bothered by programs that jam or work slowly because this task is eating up most of your computer's memory.
Since a task might run for a long time, the Task Scheduler allows you to condition the task so it starts only when the computer is on AC power, and to stop the task if you switch to battery power. Moreover, if your computer is on sleep mode and the time to run a task comes, you can put the computer to wake to run the task.
If you know that you need a specific network connection for the task, check the box 'Start only if the following network connection is available' and choose from the drop-down box the connection that you are interested in.
Set the Task's Failure Behavior
Task Scheduler allows you to make settings which come in handy in special scenarios such as: task failure, task stopping or not ending. For such settings, go to the Settings tab in Create Task window.
You can make the following settings:
- Allow the task to run on demand. Otherwise, it will only run when both the triggers and conditions are met;
- If the task is based on a schedule which is missed, you can set the task to be run as soon as possible;
- For the cases when the task fails, you can set it to be restarted every 1, 5, 10, 15, 30 minutes, or 1-2 hours. The restart can be attempted for a number of times that you can set;
- If you think that something has gone wrong with your task, and it runs longer than 1, 2, 4, 8, 12 hours, or 1-2 days, you can set it to stop;
- If a task is not scheduled to run again, you can set your computer to automatically delete the task after 30, 90, 180, 365 days or immediately.
- If the task is already running and the time comes run again, you can choose one of these options, by clicking the drop-down box:
- Do not start a new instance - just the first task continues to run;
- Run a new instance in parallel - the first task continues to run and the new task starts;
- Queue a new instance - after the first task finished, the new task is created and started;
- Stop the existing instance - the first task is stopped and the new task is run.
As you can see, the Task Scheduler offers a very large number of settings which help you create the most advanced tasks. While note all options are easy to understand at first, by reading this article and experimenting on your own, you'll get the hang of it. If you have any questions or problems, don't hesitate to ask and I'll do my best to help.