What is Windows Task Scheduler
“The Task Scheduler enables you to automatically perform routine tasks on a chosen computer. Task Scheduler does this by monitoring whatever criteria you choose (referred to as triggers) and then executing the tasks when those criteria are met.”
Let’s take a look at the Windows Task Scheduler’s user interface.
You can see that we immediately get an overview of our tasks. Both task status and active tasks. We can double click the active tasks to see their settings. That is not something you’d want to mess with since there are many default Windows tasks there that need to be done.
On the right you have actions that you can take, like create a new task, connect to another computer, display tasks and more. This right sidebar is basically a quick access to most used actions.
On the left panel, you have your file structure containing all scheduled tasks in a library. Here you can create a new folder to put your tasks in separately form other system tasks.
When creating new task, you have 2 options:
- Create basic task
- Create task
The main difference is that basic task creation acts like a wizard with predefined steps that you need to go through. On the other hand, task creation lets you manipulate more options. It also lets you to create and configure the task in order that you see fit.
New basic task
It’s advised that you create a new directory for your tasks so you can manage them more easily and so you don’t mix them with other system tasks.
Now let’s take a look at all the tabs in task creation so you can get a good look at what you can do here.
Here you add your:
- Task name and description
- Choose the directory where you want to put it
- Select run options
- Configuration for certain Windows OS version.
Run options are the ones that may have a big impact on your task and they can sometimes be the reason why your task fails to run. So, be sure to make the correct run choice. Run with highest privileges is like running it as an administrator.
As you can see there are only 3 tasks and 2 of them are deprecated which means Microsoft no longer maintains them and they may or may not work. That pretty much leaves you with only 1 available task to perform and that is opening a program. However, that one task is more than enough to do some serious automation if you combine it with complex scripts that can be performed with it.
Honestly, I don’t know why sending an e-mail is deprecated since it could be a great little automation trick to send a mail on a certain trigger to inform the user about certain things, specially if that computer is a remote computer. But you can do that with the “start a program” task if you get a little creative so that’s probably why sending an e-mail is deprecated.
Triggers control what triggers your task to run and there’s a lot of options here since this is the primary focus of the Windows task scheduler. Your task may be opening a script or a program but the real work will be done in that script and task scheduler will just run it on a specific trigger.
You can add more than one trigger to a task because you might want to run that task on more different occasions. Let’s say, once a week and every last day of the month. So you can just add those 2 triggers to your task.
Let’s take a look and talk a little bit about different types of triggers since they’re the most important part of Windows task scheduler.
This type of trigger is great if you have a task that has to execute at a specific time rather than after an event. Here you really have a lot of flexibility with the time that you can set as a trigger and of course, you can set multiple “on schedule” triggers.
On log on
If you wanted to automate a task so that it executes every time when you start working on your computer, this is the perfect trigger for you. The task will execute as soon as you log into your computer.
This trigger executes the task on computer startup. If you think that this is the same as “on login” trigger, yeah, it can be. But, this task will execute on startup when any user logs in. You can set “on login” trigger to execute a task when a specific user logs in. It just adds another layer of flexibility which, in my opinion, is great.
We won’t make a gif here because this trigger has the same parameters as “at startup” trigger. The only difference is that this trigger waits for the PC to enter the “idle” state.
This trigger is particularly interesting because it is very simple to use and very helpful. Why would let your computer to run for no reason if you went to the bathroom or something. Also, if you like to leave your computer ON over the day when you’re at work, it would be great to automate some tasks that the computer would do when you’re not around. Such as cleanup, backup, disc defrag and so on.
On an event
On an event trigger is quite complex because you can choose from predefined events, make your own or even provide an XML event filter.
As you can see, there’s a lot of options in this trigger which makes it the most interesting one.
My issue with this one is that there’s no explanation what you need to write in any field and how the events work. So, you’re pretty much on your own here. However, this is just a trigger so you can fiddle with it as much as you like. There isn’t really anything wrong that you can do here if your task is harmless so testing is quite safe.
On task creation/modification
We won’t make a gif here because this trigger has the same parameters as “at startup” and “on idle” trigger. This trigger set’s off when a task is created or modified. It can seem a bit pointless, but you may want to trigger a backup or some tests when a task is created or modified.
On connection to user session or disconnect from user session
This trigger executes a task when the user connects to a remote or local session, or disconnects from a local or remote session. These are actually 2 different triggers, but they are pretty much the same, one just activates a task on connection and the other activates a task on disconnection. The settings and parameters are the same.
On workstation lock and unlock
Those are actually 2 different triggers that you can choose, but they have the same parameters, they just track the opposite thing. That is, to lock and unlock of the workstation.
So, this trigger executes a task when you lock or unlock your workstation. This can be somewhat similar to “on login” trigger, so this is, kind off, another layer of flexibility.
Conditions help you further specify your task triggering and execution. Some of the options are to start the task only if the computer is idling, start the task only if the computer is on AC power (which is meant for laptops I presume), and start the task only if the computer is on a specific network.
Settings, similarly to conditions, specifies additional options for running task. Such as what should the task do if it fails to run (for example, if the computer is off). Also it offers a way to deal with task instances, it can prevent them, run them in parallel, queue other instances and more. You can also tell a task when to stop if it’s running for a long time.
Now we’re gonna show you a quick example of a simple automated task that opens a notepad program on exact time schedule.
I had to cut out the time to open the notepad because it’d be pointless to wait a minute to see the notepad opening. You can follow the gif and try the task for yourself.
You should really try and experiment with task scheduler because it has much to offer if you use it correctly. My only problem is that there isn’t much help and explanation for the features that the task scheduler offers and you have to just figure it out yourself. It’d be nice to have some help or better documentation explaining different triggers and some examples going a little bit in depth with the stuff that you can do. Don’t get me wrong, the documentation is good, but you don’t really find out how to use some features properly.
Windows task scheduler is great for scheduling small isolated tasks (as the name suggests).
However, it’s not well suited for scheduling multiple interconnected tasks. For example, what if you need one task to start after another, but you have to schedule them separately. You might have a problem where on task doesn’t run or cannot finish successfully. Then the other task will start either way and you’ll have a problem which you’ll have to manually identify. To make up for that, you can make your scripts more flexible and make them run on certain parameters. But still, for automating more complicated workflows and multiple tasks, you’re better off finding an alternative to Windows task scheduler.
If you want to explore a little bit more, there’s a Task Scheduler API.