Open the Task Scheduler Snapin with Administrator Privileges
- Hold down the Windows Key and hit R
- Type ‘mmc’ in the open field and hit okay
- Click ‘yes’ on the User Account Control security prompt
- Click File > Add/Remove Snap-in
- Scroll to the bottom of the list of available snap-ins.
- Click Task Schedule then click Add
- Choose local computer and hit OK
- Hit OK again
- Click Task Scheduler (Local) in the left-side snap-in tree.
Now you can either click ‘Create Basic Task’ or ‘Create Task’ under the right side ‘Actions’ menu
Create Basic Task: Gives you a wizard which is easiest if you are less of a power user or want to be walked through the process.
Create Task: Gives you more advanced options and doesn’t hold your hand through the process.
Here is the end of the Basic Task Process:
Schedule PowerShell Task
Powershell scripts can’t be automatically executed by Tasks alone. They have to be executed by powershell.exe with arguments which run the script.
- Open the ‘Action’ tab of the task
- Click ‘Edit’
- Type powershell as the Program/Script (yes it does say script but don’t actually put a script there.)
- for the arguments, type (including quotes) -command “& C:\path\to\script.ps1” NOTE: I’m having trouble if there are spaces in the script path. The normal tricks aren’t working. Best to avoid spaces altogether.
- Click okay
Expire Task Automatically
If you want the task to expire automatically — I do because I don’t want this thing to run forever — Make sure ‘open the properties dialog’ checkbox is checked from the wizard. Then click finish
If you went the advanced route, start here:
- Click the triggers tab
- Click the first trigger in the list (ie the one which says how often your task runs) There should only be one. Mine says weekly.
- Check the box next to expire
- Set the time/date
- Click OK
Check on the task