Search code examples
powershellwindows-task-scheduler

How do I execute a PowerShell script automatically using Windows 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.

I am using Windows 7 Professional and PowerShell version 2.0.5.


Solution

  • Create the scheduled task and set the action to:

    Program/Script: Powershell.exe

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