KBI 311885 Running PowerShell Scripts Directly From Argent Job Scheduler
Version
Argent Scheduling Engine 10.0-2010-A
Date
Friday, 13 November 2020
Summary
How to set up Argent Job Scheduler to run PowerShell scripts
Technical Background
Windows PowerShell scripts by default are disabled and must be enabled to execute directly
Argent Job Scheduler can run Windows PowerShell scripts
Resolution
Update Argent Queue Engine servers to allow execution of Windows PowerShell script
This must be done on each Argent Queue Engine server
See Microsoft documentation for more assistance
Option One
Create new Job Template
Under Job Basic (JW20A)
Job File should be set to
\\localhost\C$\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Parameters should be set to
-NonInteractive -NoLogo -ExecutionPolicy bypass -Command “& { $ErrorActionPreference = ‘continue’; & ‘c:\scripts\NameOfscript.ps1’ @args; EXIT $LASTEXITCODE }”
Option Two
Create File Association with “.ps1” to open file with PowerShell
Create new Job Template
Under> Job Basic (JW20A)
Job File should be set to location of PowerShell script
Warning: Exit code from PowerShell script will not be passed to Argent Job Scheduler
Argent Job Scheduler will consider all PowerShell script failures having an exit code of 1