How to schedule PowerShell scripts using Windows Tasks
Last week I blogged here about PowerShell v3 and a new feature that is going to do the content of topic automatically however if you don’t have Windows 8/PowerShell 3 and you want to configure a script that you created to run on Windows Server 2008 R2 these following steps can be used:
If your script is not digitally signed, you can run the Set-ExecutionPolicy –ExecutionPolicy Unrestricted as shown in the figure below.
Now, it’s time to create a new Windows Task and what really matters for us is the Start a Program section, and these following values must be entered:
- Program/Script field:
- Add arguments (optional) field
-NoLogo -NonInteractive -File C:\path\yourscript.ps1
All pieces together are shown in the picture below.
That’s all my friends, from now your PowerShell scripts will work just fine. I do recommend to do a test and depending of the script you may want to configure a specific account to run on the Task and also to configure the script to
Cheers, Anderson Patricio http://www.andersonpatricio.ca http://www.andersonpatricio.org