Scheduled Tasks

Setting up scheduled tasks in Task Manager can save time and effort from running jobs manually.

First open Task Scheduler in Windows. In the left-hand pane navigate down to the “Windows” folder. Although the folders inside of Task Scheduler are purely organizational and you could put scheduled tasks anywhere, the Windows folder is usually most appropriate.

Next, right-click in any empty space on the right pane and select “Create Basic Task”. This will start the Create Basic Task Wizard.

Now you can name your task and add a description. The name is very important as it will be what is shown when you select tasks later.

The “Trigger” pages allow you to choose when and how often your task will run. There are further refinements that can be done to the trigger in the file properties dialog when we are done here.

Most tasks will need the action set as “Start a Program”.

Scheduled tasks that run scripts can be tricky to setup correctly and the way you set them up is different for different types of scripts. There are three parts to configuring a script as an action.

A: Program / Script – If you are running a VBS, CMD or BAT script you can just put the full path to the script here (Ex: C:\CMD\SpaceCop\SpaceCop.vbs). If however the script is a PowerShell script you must put the complete path to the PowerShell.exe file here (Ex: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe)

B: Add Arguments (optional) – If your script does different things with command line arguments, add those arguments here. If your script is a PowerShell script, put the full path to the script here (Ex: C:\CMD\PS-NetMon\PS-NetMon.PS1).

C: Start In (optional) – Although optional this should be set to the path of the script to avoid any conflicts with not fully path-defined calls that may exist in the script (Ex: C:\CMD\PS-NetMon).

If there are options you would like to fine tune make sure the “Open properties dialog box…” option is checked before clicking finish.

If you opted for the properties dialog box there are a few important settings to set.

“…use the following user account” should be set to an account that has the proper levels of access to run the script at hand.

“Run whether the user is logged on or not” should always be set for automated tasks, otherwise they will not run when the above set user is not logged into the machine.

“Run with highest privileges” is an option to check if your script is not running correctly. This is similar to the “Run as administrator” for running programs in the fact that this will elevate the account specified above to its highest access levels to run the task.

“Hidden” only really matters if you are running the task with the same credentials used to log into the system. If the account used to run the task is used to log into Windows then that user may see the task window open and run while they are logged in.

Once you have completed your task creation you should always run it to make sure it works properly as a scheduled task. This is accomplished by right-clicking your task and selecting “Run”.

That’s all there is to it. The way I look at it; Every time you create a script and add it to the task scheduler it is one less thing you have to do in a day.

-fin