Just discovered a funny problem with Powershell as Custiom EXE/XML sensor and PRTG Version 188.8.131.526
I added a "set-psdebug –strict“ at the beginning of the script and the sensor was not working anymore, due an error.
… <text>Exchange Lost:</text> </prtg> The variable '$LASTEXITCODE' cannot be retrieved because it has not been set. At line:1 char:102 + &'C:\Program Files (x86)\PRTG Network Monitor\custom sensors\EXEXML\exchangehealth.ps1' ; exit $LASTEXITCODE <<<< + CategoryInfo : InvalidOperation: (LASTEXITCODE:Token) , RuntimeException + FullyQualifiedErrorId : VariableIsUndefined
The funny thing: I'm not using the variable '$LASTEXITCODE' anywhere in the code. And the "line 1" is a comment, so i assume that PRTG has some kind of wrapper around my script. No problem at all, i can simply remove that but you should be aware of that.