Automating tasks has never been easier in Windows. Task Scheduler allow you to set certain conditions resulting in an action. We can open a certain program every time we do something such as when your computers boots up to the desktop, or a user/specific user logs onto their computer. This also makes doing simple maintenance on your computer easy and worry-free, done are the days of having to manually run a piece of software to check your system files for corruption or maybe your hard drive needs to be defragged weekly. There’s a solution for everything.
This automated program goes by the name of “Task Scheduler”. You can find it under Control Panel->Administrative Tools->Task Scheduler or by going to your Start Menu and entering it in the search bar.
You will now see Task Scheduler in all its glory. On the left-hand side, all the folders are specified by their respective programs and to the right are our “Actions” section. The tasks will for the most part be stored within them with the exception of our “root” task directory which is “Task Scheduler Library”, click on it.
We now have a list of tasks displayed. These ones have been installed by default from various software vendors. Here you will find the following:
- Name – Name of the task created.
- Status – Whether the task is active or not active.
- Triggers – The condition(s) that needs to be met in order to execute the task’s “Action”.
- Next Run Time – The time for when the task will be run again(highly varies upon configuration).
- Last Run Time – When it was ran last.
- Last Run Result – Displays whether the task ran successfully or with an error.
Tasks vary from computer to computer. If you go back to “Task Scheduler (Local)” and scroll down to “Active Tasks”, you will notice an abundance of tasks ready to run. Most of these are defined by the system and cannot be removed.
Creating a Task in Task Scheduler
Under “Actions”, there are 2 ways to create a task: a “Basic Task” and a regular “Task”. The difference between the 2 are the configuration options available such as creating multiple triggers in a regular task and defining some user privileges for executing the task. Lets look at some examples as to what you can do with tasks.
Reboot the computer every night at midnight
We will be creating a basic task that involves rebooting your computer every night at midnight. Click on “Create Basic Task…”
We will now define a name for our task. You are free to name it whatever you like. I will go with “Reboot computer”. A description is optional. Click “Next”.
You are going to configure when you want the task to start which is set to “Daily” by default. Click “Next”.
Here you will configure start time/date and how often it should be executed. We will do 12:00AM for the time and have it recur every 1 day(s). Click “Next” once you’ve completed that.
We are now going to define an action for our task. If you’re using the latest version of Windows, the other options have been “deprecated”. A program will be run in order to tell our computer to reboot. Click “Next”.
Under “Program/script:” type in shutdown, and we will be adding arguments to tell the shutdown program to do certain things. In “Add arguments (optional):” type “/r /f /t 0”. /r tells shutdown that we are going to shutdown the computer and restart it, /f forces all programs to close, and /t 0 disables the countdown timer to shutdown our computer. Click “Next” when you’re done.
Make sure everything is correct, and click “Finish” to close. If you need to make any changes to your task, either click the check box beforehand or navigate back. Now when you go to your “Task Scheduler Library” you will notice that your task has been implemented successfully. If you have no need for this particular task until later on, for example, under the “Actions” pane click on disable to prevent it from running until you decide to re-enable.
Start a program when a user logs in
In order for our user to start a program when he/she logs into their Windows account, we are going to need a task with a bit more depth. For this part we are going to create an regular task. Under the “Actions” pane go ahead and click on “Create Task…”
While it may look similar to the basic task wizard, there are additional options that we can tinker with. Again feel free to name it whatever you like, but I will go ahead and name it “User login”. Under “Security options”, we will be leaving the option “Run only when the user is logged on” selected as the program we will be running will most likely require user interaction. Under it, click on “Run with highest privileges” to guarantee successful execution. Click the drop-down menu next to “Configure-for:” and select your current operating system for the best compatibility.
Next, we will be creating a trigger under the “Triggers” tab for our task to check upon execution. Again, these are the conditions that will need to be met in order for our action to work. Click on the “New…” button at the bottom.
Right next to “Begin the task:” click the drop-down menu and select “At log on”. “Any user” is specified under settings. In “Advanced settings” lets click on “Delay task for:” and set it to 30 seconds so that we can give Windows time to load the desktop and any applications running in the background. Click “OK”.
Move to the “Actions” tab. We are now going to create an action to execute our program.
Click “New…”, “Start a program” has already been selected by default. Right next to “Program/script:” click the “Browse…” button and look for a program to run. I will be using Firefox which is located at “C:\Program Files\Mozilla Firefox\firefox.exe”, if you have the 32-bit version installed then it’s going to be located in “C:\Program Files (x86)\Mozilla Firefox\firefox.exe”. After click “OK” to save.
Both the Conditions and Settings tab contain additional options on top of using triggers. Adjust them according to your specific needs. Once that’s complete go ahead and click “OK” to finish creating our task.
You have now successfully configured your first 2 tasks!