## Run PowerShell Scripts from Task Scheduler

Posted by Drothism on Feb 26th, 2009

Those familiar with configuring batch command scripts in the Windows Server 2008 or Windows Vista Task Scheduler may be a little perplexed in how to run PowerShell scripts from the scheduler. The main difference is in the Action form parameters…

Program/script: Set to the PowerShell.exe path. This is typically C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe.

Add arguments: -nolog -command “&{D:\Scripts\MyScript.ps1 Param1 Param2}”. Note that the PowerShell script path and the parameters must be within the curly brackets.

Start in: D:\Scripts. This should be added if you plan to use referenced rather than absolute paths within the script.

Ensure the PowerShell execution policy is set to RemoteSigned on the machine. To do this type “set-executionpolicy RemoteSigned” from the PowerShell command prompt.