Advanced Users - Task Creation With Task Scheduler

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 task. Are you ready? Click on Read more...

Finding the Create Task Button

Open 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'.

Task Scheduler

The pane that now opens is similar to those which show you the properties of a task, explained in the First Steps in Working With Task Scheduler.

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 available options, together with a few usage examples.

Set the Task's Name, Description & Security Options

The first tab of the 'Create Task' window is called 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 make use of another user account when running the task, click on the 'Change User or Group' button.

Task Scheduler

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. Therefore, choose the option you like best.

Task Scheduler

If your task needs administrator permissions, don't forget to mark the check-box 'Run with highest privileges'.

Task Scheduler

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.

Task Scheduler

That's in terms of 'general' properties. Next, we will cover triggers.

Set the Task's Triggers

Unlike with the 'Create Basic Task' wizard, you can now set multiple triggers. To do this, click on the Triggers tab.

Task Scheduler

To add a new trigger, click on the New button.

Task Scheduler

The first trigger setting is to select when to begin the task. Click on the 'Begin the task' drop-down box and choose one of the available options.

Task Scheduler

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. For the 5 triggers that appear also in the 'Create Basic Task' wizard, the settings that can be done are the same to those available in the wizard.
The 'Advanced settings' options remain the same no matter what 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. For the latter, the default is current user. However, you can press the 'Change User' button to choose another user.
  • Establish if connection refers to connection from remote or local computer.

Task Scheduler

For the triggers 'On workstation lock' and 'On workstation unlock' 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. Press the 'Change User' button to select another.

Task Scheduler

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 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 that 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 between which your task will be run when the trigger that you specify is met;
  • You can enable or disable the task.

Task Scheduler

Press OK when you have finished with the settings for this trigger. Your new trigger will be 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.

Task Scheduler

Set the Task's Actions

You can set more actions to a task. Go to the Actions tab and press the New button.

Task Scheduler

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.

Task Scheduler

If you choose to start a program, click on 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 e-mail 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.

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 you an e-mail notification that the process has started.

You can change the order of the actions by clicking on the buttons found on the right-hand side of the actions list.

Task Scheduler

To modify a task, select it and press Edit. To remove it, click the Delete button.

Task Scheduler

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.

Task Scheduler

If you want your task to not 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 for a certain period of time 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 of this task eating up most of your computer's memory.

Task Scheduler

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.

Task Scheduler

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.

Task Scheduler

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.

Task Scheduler

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 to be run again, you can choose one of the options by clicking the drop-down box:
    • Do not start a new instance - just the first task will be run;
    • Run a new instance in parallel - the first task will continue to run and the new task also starts;
    • Queue a new instance - after the first task finished, the new task will be created and started;
    • Stop the existing instance - the first task is stopped and the new task is created.

Conclusion

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 seem easy to understand at first, by carefully 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.

Related articles:

How to Create a Task With The Basic Task Wizard
First Steps in Working With Task Scheduler
How to Manage Existing Tasks in Task Scheduler
Wake the Computer to Run a Microsoft Security Essentials Scan

Comments

Hi There,

Thanks for the article; I would like three programs to run automatically (and in a particular order) when a trigger is activated.

When the task is triggered, the first program on the list runs (as it should), but then nothing else happens. When I close the program that opened, the second program opens, and then nothing happens - the third program still has not run at this stage. Then, when I close the second program, the third opens. After closing the third program, nothing happens - the task has been completed... not exactly what I had in mind...

Is there a way to make all three programs open instantly, one after the other - all in the space of one second-or-so?

Thanks,

Will

Yes there is. You must make a .bat file (a simple .txt file saved as .bat in the name of the file, save as "all files" option) containing the instructions to open the programs such as this:

start C:\etc\etc.\program1.exe
start C:\etc\etc.\program1.exe
start C:\etc\etc.\program1.exe

Then you schedule this file instead of the programs.

However, this will open all the 3 programs in the same moment, so you should insert between each row a command to delay the start of the next command (google it).

Bye,

manuel

Hi Manuel.
I have set a task to run in my scheduler: I want it to open a text document each night to remind me to do something. I have experimented extensively with this and have had no joy - settings are as follows:
General: Name: Reminder
Location: \
Author: Tez (<- Administrator Status)
Description: (blank)
Set to Run whether user is logged on or not
Run with Highest Privileges is ticked
Hidden is NOT ticked
Triggers: Set to run every day at 8:30 PM
Actions: Start a Program: c:\windows\system32\notepad.exe
Added Argument: c:\Users\Tez\Documents\reminder.txt
Conditions: (None Set)
Settings: Allow task to be run on demand is ticked
Stop the task if it runs longer than: '3 days' is selected
Force to stop is ticked
If running, Do Not start a new instance is selected

Now, I have tried the actions line in a command prompt and they in fact start my reminder.txt - it appears in notepad on the desktop as I would like(which is the desired result!).

If I watch as the time trigger passes, refreshing the status shows that the task is "running" but no notepad appears and hence no reminder.
Task manager shows no instance of Notepad, even though Task Scheduler says it is currently "running"
- I can end the task and it changes back to ready. - Still no notepad appears! - If I then review tasks that have "run" in the last 24 hours, the report is blank.

Since the rminder is a one-line text document, I've even tried setting the task action to open a message, but that does not appear on the screen either

Any assistance would be helpful - this is doing my head in! - Task Scheduler under WinXPPro was o much simpler and reliable!

Great job on the documentation. I'm embarrassed to even ask this because the task scheduler seems so straight forward but I'm struggling to get an access program that has been running under os 2003 scheduler to run in Windows 7 task scheduler. The area I'm wondering about is the action tab. I browse to the Access program which resides on a different server to run a daily report. Each time I attempt to run I receive invalid directory despite my navigating directly to it. Any suggestions on anything else I could try? Thanks in advance for your help
Shan

Why don't you try to create the task to run that program directly on the computer on which it resides?
This will eliminate complications with running a remote program, on another computer on the network.

While your suggestion has merit, we currently have 18 schedule jobs that run various updates or reports daily in our 2003 scheduler. We really like the convenience of checking this separate computer set up specifically to run jobs and as a backup computer. We can see at a glance if there are any problems. If we moved all our scheduled jobs to the SERVER that houses the code we wouldn't be as aware if problems arose and things weren't running with out physically remoting into the server each day. We have logic to send messages if problems but sometimes you aren't aware if other problems occur. Today we can quickly glance to see if something is hung or there was an issue. I tried copying the access program to the Windows 7 computer I'm trying to set up Scheduled tasks on to see if that would resolve it and got the error > %1 is not a valid win32 application. While the task scheduler seems to runs .exe and .bat files fine I'm wondering if its unable to run .accb Win 7 Access programs? Just doesn't seem like it should be this difficult to set up.
Shan

Do you have Access installed on the Windows 7 computer where you are trying to run the program?

Yes. Since we're moving to Office 10, its the computer we are using to convert all the 2003 Access programs to 2010 Access.

Add new comment