How do I execute a PowerShell script automatically using Windows task scheduler?

AK47 picture AK47 · May 30, 2014 · Viewed 111.7k times · Source

I have one PowerShell script which sends emails. I want to execute that script automatically, every 1 minute. How can I do it, using task scheduler?

Currently I have created a task and provided the path of my script. But that scheduler opens my script, instead of executing.

Answer

Kevin_ picture Kevin_ · May 30, 2014

Create the scheduled task and set the action to:

Program/Script: Powershell.exe

Arguments: -File "C:\Users\MyUser\Documents\ThisisMyFile.ps1"