This post is a quick summary demonstrating how to run a PowerShell script from the Task Scheduler without and with passing parameters.

Run PowerShell Scripts from Windows Task Scheduler

Program/script:

The Program to run is PowerShell.exe. This will run the PowerShell process and the next step (arguments) will run the script.

Add arguments (optional):

The argument should contain the path to the PowerShell script to be run. This works because the command argument “-File”

Running a PowerShell Script from Task Scheduler with Parameters

Program/script:

Add arguments (optional):

We use “-Command” argument to identify that we want to run the script file and pass through parameters. Executes the specified commands (and any parameters) as though they were typed at the Windows PowerShell command prompt, and then exits, unless the NoExit parameter is specified.

Everything after “-Command” must be enclosed in double quotes and where you would normally use double quotes without the command replace them with single quotes.