Script Returns No Result

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Post Reply
jjohnso7
Posts: 5
Joined: Wed Aug 24, 2016 3:02 pm

Script Returns No Result

Post by jjohnso7 »

I set up HostMonitor to run a shell script to get some data from a server. I have a Powershell script pasted into the HostMonitor script manager. The script runs and writes an output text file. However, HostMonitor complains when the script completes and says, Error: Script returns no results. I have tried varying the output of the Powershell script to produce various results, but it either says "Error: Invalid result" for multiple line output or "Error: Script returns no result" for a single line result. The script runs fine when it is run manually.

$z = Get-ActiveTCPConnections
Write-Output $z | Out-File "C:\MonitorServer\MonitorServerResources.txt"
$x = "1"
Write-Output $x
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

Scripts used with Shell Script Test should return/echo reply in the following format:
ScriptRes:<Status>:<Reply text>
Several examples:
ScriptRes:Ok:10
ScriptRes:Bad:100 ms
ScriptRes:Unknown:Script requires 2 parameters

Your script can be modified the following way:

Code: Select all

$statusOk          = "ScriptRes:Ok:"
$statusBad         = "ScriptRes:Bad:"
$statusUnknown     = "ScriptRes:Unknown:"

$z = Get-ActiveTCPConnections 
Write-Output $z | Out-File "C:\MonitorServer\MonitorServerResources.txt" 
$x = "1" 
Write-Output $statusOk$x
jjohnso7
Posts: 5
Joined: Wed Aug 24, 2016 3:02 pm

Post by jjohnso7 »

Your changes worked.

Thank you!

James
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

You are welcome!
Post Reply