Running PowerShell Script from Scheduler
Related Pages:
Example:
To call the .ps1 script AD_Runner.ps1
For both Microsoft Task Scheduler and SQL Server Agent use:
powershell -file
“<path>\AD_Runner.ps1”
Replace
<path>
with the full path toAD_Runner.ps1
In SQL Server Agent:
Step tab:
Type: Operating System (CmdExec)
Call the Powershell script with:
powershell -file “ ... \AD_Runner.ps1”
Opening PowerShell if the powershell
Shortcut Doesn't Work
In the examples powershell
calls a standard Windows shortcut. On Windows systems the shortcuts installed by Windows call:
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe
Find the powershell.exe file and use the entire path & file name.
In this section