
Jaroslav Faldik (Customer) asked a question.
How should a PowerShell script used as an Action end correctly so that it passes the Action test successfully and is subsequently logged as a "success"?
I use a PowerShell script to send SMS messages (SMS over VoLTE) via an SMS gateway. This works for me, but I have a problem with the script code validation in WUG. When the script ends in Windows PowerShell ISE with the expected response from the SMS gateway after executing the command, the WUG test fails with the error "Error executing script: No result text". Conversely, if the script runs in Windows PowerShell ISE but ends with the message "You cannot call a method on a null-valued expression," the test in WUG completes successfully with:
"Result:
<?xml version="1.0" encoding="utf-8"?> <Root> <QueueAddResponse> <Rslt>1</Rslt> <ID>97</ID> </QueueAddResponse> </Root>", which is the expected valid response from the SMS gateway.
Does WUG expect a specific text format when testing the script?
Translated with DeepL.com (free version)
Just like monitors you MUST tell WhatsUp Gold did your script finish successfully or not. You use the Context.SetResult for this.
In PowerShell:
Successful
Unsuccessful
0 = Success
1 = failure
More info: https://docs.progress.com/bundle/whatsupgold-user-help-26-0/page/Using-the-context-object-with-actions.html