Powershell – How to execute a PowerShell script automatically using Windows task scheduler

powershellwindows-task-scheduler

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.

Best Answer

Create the scheduled task and set the action to:

Program/Script: Powershell.exe

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