We are currently having a problem with a script sensor that leverages the citrix broker plugins to check if a machien is in maintenance mode, When testing the script on the PRTG server directly the output is showing correctly however the value of the output from within PRTG is showing incorrectly.
Do scripts within PRTG run differently in any way? potentially an issue with the variables?
Script:
asnp Citrix.broker* function MaintenanceModeValue () { $MaintenanceMode = Get-BrokerMachine -MachineName <machine name> -adminaddress <Delivery controller> | select InMaintenanceMode -ExpandProperty InMaintenanceMode If ($MaintenanceMode -eq $False) { Write-Host "0:Maintenance Mode Disabled"; } Else { Write-Host "2:Maintenance Mode Enabled"; } } MaintenanceModeValue;
The output received is always "2:Maintenance Mode Enabled" despite what the actual value of InMaintenanceMode is. Also, If I change the equals factor to $True instead of $False the script still outputs "2:Maintenance Mode Enabled". this makes me believe that when the script runs in PRTG the $MaintenanceMode Variable is reporting back with something other than either true or false.
as mentioned before the script runs perfectly when running within powershell directly from the server that hosts PRTG
Is there a way that i can test the output of what PRTG is actually seeing when running the script?
Add comment