Ideally in our environment, we do not want to open up the execution policy. We've avoided this when running scripts via task scheduler by running them in the following way;Powershell wrapping
ps1=cmd /c echo scripts\\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -
Bolded for attention is the switch that lets an admin do a one time bypass of the execution policy. This lets us keep it restricted system wide, while still running automated tasks.powershell.exe -NoProfile -NoLogo -NonInteractive -ExecutionPolicy Bypass -File C:\PATH\TO\FILE\script.ps1
From my own research and testing, Nagios does not support this switch, due to the weird wrapping.
Is there any possibility of further support for this in the future?