Opsview + Powershell

Powershell InvocationSyntax

The syntax for properly calling powershell scripts from the Opsview/NRPE agent is rather cryptic.

After much searching on the internets, this is the configuration syntax I found to work:
nsc.ini:

[nrpe handlers]

check_mycheck = cmd /c echo DriveLetter:\Path\Folder\MyScript.ps1; exit($lastexitcode) | powershell.exe -command -

Sources

Description URL Notes Check mit Powershell http://www.monitoring-portal.org/wbb/index.php?page=Thread&threadID=15923 This website was in (German?); Google Search:"nsclient
.exe" "powershell" "socket timeout after" Nagios – check_veeam https://www.angryadmin.co.uk/?tag=nagios Google Search:"nsclient
.exe" "$lastexitcode" Returning Exit Code from Script http://powershell.com/cs/blogs/tips/archive/2009/05/18/returning-exit-code-from-script.aspx Google Search: bat exit /b errorlevel Mailbox Health 2007.ps1 http://exchange.nagios.org/directory/Plugins/Email-and-Groupware/Microsoft-Exchange/Mailbox-Health-2007-2Eps1/details Google Search: "nagios" "powershell" "exit code"