An Engineers Notebook

How to run a Power Shell script from Task Scheduler


You are unable to get a Power Shell file to execute using the Task Scheduler


Two reasons:

  1. The execution policy needs to be set to Unrestricted
  2. The command in Task Scheduler needs to adhere to the correct syntax
  3. You must store the script in a place PowerShell trusts.

Firstly, store your powershell script in a place PowerShell trusts. To find this, open PowerShell and run:


You will note that one of the safe places is “C:WindowsSystem32”.

Next, Set the execution Policy to Unrestricted using PowerShell. Open PowerShell as administrator and run:

Set-ExecutionPolicy -ExecutionPolicy Unrestricted

Press “A” to accept the changes. If you are using a computer account to run the script, you may need to set the execution policy on the local machine to Unrestricted like this:

Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope LocalMachine

Create a sheduled task as desired. On the actions tab the script must be run like this:

PowerShell.exe “C:WindowsSystem32MyScript.ps1”

Taking care to wrap the path in double quotes. 

Leave a Reply

Your email address will not be published.