Hello,
My question is, how can I return a warning status from a Powershell script? Success or critical is easy to achieve but it doesn’t seem like returning a warning.
I have a script that I’m using to query the status of SAP services on our servers. If SAP is down it detects an error and returns that, however, we get false positives or blips that mean the monitor turns red for a few minutes when actually there’s nothing wrong.
What I want to be able to do is return a warning initially to indicate something may be up and change the monitor to yellow, then if it’s just a blip that can turn green again on the next check, if there is still an issue it will go red.
Below is my code to return that I’ve been fiddling with including and excluding Success and I read somewhere that I might be able to return Level with a value of warning… but that doesn’t seem to do anything.
$result = New-Object -TypeName PSobject -Property @{
‘Success’ = $return
‘Description’ = $description
‘Level’ = $level
}
return $result
Any help would be appreciated.
Thanks.