How to Create Advanced Tasks with the Task Scheduler
In today's article I am going to cover some of Task Scheduler's advanced features: creating advanced tasks, setting up their triggers, actions and security options. They are really powerful when you want to be in control of your system and the tasks it is running. Be prepared for a large range of choices which allow you to set up every possible detail related to scheduled tasks.
NOTE: This guide applies to Windows 7, Windows 8 and 8.1.
How to Create an Advanced Task
First, open the Task Scheduler application. To learn how to do this, check this article: How to Browse the Task Scheduler & Learn More About Existing Tasks.
To create a new task, go to the Actions panel and, on the right hand side, click or tap Create Task.
The wizard displayed is similar to those which show the properties of a task.
With it you can set up every detail about your new task, starting with its name and continuing with setting one or multiple triggers, actions, establishing conditions for running the task and so on. Let's see how it works:
How to Set the Name, Description & Security Options of a Task
The first tab of the Create Task wizard is named General. Here you can set the name of the task and its description. Unlike the Create Basic Task wizard, you can also configure 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 for creating the task. If you want to make use of another user account when running the task, click or tap the "Change User or Group" button.
You can choose either to run the task only when the user is logged on or run it regardless of this aspect. For example, tasks like Disk Cleanup, can be set to run even when the user is not logged on.
If your task needs administrator permissions, don't forget to check the "Run with highest privileges" check box.
Check the Hidden check box if you don't want the task to be visible. This means that the logged on user will not be notified when the task is started or ended.
That's all there is in terms of general settings. Let's go to the Triggers tab.
How to Set the Triggers of a Task
Unlike with the Create Basic Task wizard, you can now set multiple triggers. To do this, click or tap the Triggers tab.
To add a new trigger, click or tap the New button.
The first trigger setting is to select when to begin the task. Click or tap 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 the option you chose, you will be required to set different things in the Settings pane. The Advanced settings that are available remain the same no matter what trigger you choose.
For the triggers named "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. For the latter, the default is current user. However, you can click or tap Change User and choose another user.
- Establish if connection refers to a connection from a remote or a local computer.
For the "On workstation lock" and "On workstation unlock" triggers you will only have to set if this refers to any user or to a specific user. By default, the specific user is the current one. You can click or tap Change User to select another user account.
The available Advanced settings are common for all triggers. For each available option, you must first check the corresponding box to see the list of corresponding 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 the time period you specify you can choose to have it stopped automatically;
- You can set an activation and expiration date and time. This means the dates between which your task will be run when the trigger that you specify is met;
- You can enable or disable the task.
Click or tap OK when you have finished with the settings for this trigger. Your new trigger is displayed in the list of triggers. You can either create a new one, or select an already created trigger to edit it or delete it.
How to Set the Actions of a Task
You can assign multiple actions to a task. To do this, go to the Actions tab and click or tap the New button.
Choose one of the actions that the task must perform by clicking or tapping the Action 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 or tap the Browse button to choose the application to be started. Then, if needed, complete the optional fields called Arguments and Start in.
If you want to send an email you have to 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, you have to specify the title and the message. Remember that in Windows 8 and 8.1, the Send an e-mail and Display a message tasks are deprecated - meaning that these actions cannot be performed in these Windows versions.
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 yourself an email notification that the process has started.
You can change the order of the actions by clicking or tapping the buttons found on the right-hand side of the actions list.
To modify a task, select it and click or tap Edit. To remove it, click or tap Delete.
How to Set up the Task Conditions
Apart from the trigger, you can specify several conditions for when the task is run based on the idle time that has passed, whether the computer is on AC power or a specific network is available. To set them, click or tap the Conditions tab.
If you want the task not to interfere with your work, you can set it to run only when the computer is idle. Check the box that says "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 an idle state for a certain period of time or you can select Don't wait for idle. When the computer is no longer in idle state, you can decide to stop the task or 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 system resources in order to run. Setting them to run when your PC or device is idle means that you will not be bothered by programs working slowly because of this task eating up most of your computer's resources.
Since a task might run for a long time, the Task Scheduler allows you to condition the task so that it starts only when the computer is on AC power, and to stop the task if you switch to battery power. If your computer is in sleep mode and it is the time to run the task, you can set the computer to wake up and run the task.
If you know that you need a specific network connection for running the task, check the box that says "Start only if the following network connection is available" and choose the connection that you are interested in.
How to Set the Failure Behavior of a Task
Task Scheduler allows you to make settings which come in handy in special scenarios such as the failure of the task or when the running task does not end when requested. Go to the Settings tab in the Create Task wizard.
You can make the following settings:
- Allow the task to run on demand, otherwise, it will only be 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 also 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 for it to run again, you can choose one of the following options:
- "Do not start a new instance" - the first instance of the task continues to run.
- "Run a new instance in parallel" - the first task instance continues to run and the new task instance also starts.
- "Queue a new instance" - the new tasks instance runs after the first task instance finished.
- "Stop the existing instance" - the first task instance is stopped and the new task instance is started.
As you can see, the Task Scheduler offers a very large number of settings which help you create lots of advanced tasks. While not all options seem easy to understand at first, by carefully reading this article and experimenting on your own, you'll quickly get the hang of it and gain more control over your computer.
If you are looking for other tips and tricks about using the Task Scheduler, don't hesitate to read the articles recommended below.