Shell Script: Error: Invalid result (ÿþ2

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
spike05
Posts: 4
Joined: Mon May 04, 2015 6:01 am

Shell Script: Error: Invalid result (ÿþ2

Post by spike05 »

I've a script that count the number of used citrix licenses.

Code: Select all

$statusOk  = "ScriptRes:Ok:" 
$statusBad = "ScriptRes:Bad:"
$Limit = $args[0]
$res = (Get-WmiObject -class "Citrix_GT_License_Pool" -Namespace "root\CitrixLicensing" -ComputerName server |Measure-Object -Property InUseCount -sum).Sum
if ($res -gt $Limit) 
{ 
echo $statusBad$res
} 
else 
{ 
echo $statusOk$res
}
The script works in the "Lets try" tab. But when i run it as a normal test i get the error "Error: Invalid result (ÿþ2"

What am i doing wrong?
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

Could you please check if you have
SScript_UseWindowsPipe=0
parameter in [misc] section of your hostmon.ini file?

Try changing it to:
SScript_UseWindowsPipe=1

HostMonitor restart is required.
spike05
Posts: 4
Joined: Mon May 04, 2015 6:01 am

Post by spike05 »

Hello,

The SScript_UseWindowsPipe= wasn't present in the file. I added the line
[misc]
SScript_UseWindowsPipe=1
and tested with a 1 and a 0 no success :(

edit:
even something as simple as

Code: Select all

echo "ScriptRes:Ok:Test Ok" 
Returns the error
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

Could you give more details:
1. What HostMonitor version do you use?
2. What Windows/Service pack do you use?
3. HostMonitor started as Application or Service?
4. What User account is used for Windows Service (services.msc) and in "Service" page of HostMontor Options dialog (local admin, domain admin, BUILt-IN Administrator)?
5. Could you start simplified script for testing:

Code: Select all

$statusOk  = "ScriptRes:Ok:" 
$statusBad = "ScriptRes:Bad:" 
$res = "noData"
echo $statusOk$res
What is test Status and Reply with this script?
spike05
Posts: 4
Joined: Mon May 04, 2015 6:01 am

Post by spike05 »

1. v10.50
2. running windows 7 enterprise SP1
3. as a service
4. Local system account (administrator) , running as domain admin
5.
Lets try tab
[4:33:06 PM] HostMonitor is going to execute "Test" script ...
[4:33:06 PM] Script executed, correct result received:
----------
- Status: Ok
- Reply: noData
----------
Reply from script
Error: Invalid result (ÿþ2
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

Could you select "Local system account" on Service page of HostMonitor Options dialog and restart HostMonitor service?
Domain admin account can be specified in services.msc
Please note, these changes may affect test items, performing connections to remote systems without explicity specified credentials.
spike05
Posts: 4
Joined: Mon May 04, 2015 6:01 am

Post by spike05 »

I've tried, but i'm getting the error "Unable to start script. A required privilege is not held by the client"
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

Could you assign "Replace a process level token" privilege to your domain admin account on the machine, where HostMonitor is running ("Administrative Tools" -> "Local Security Policy" applet -> "Local Policies" -> "User Rights Assignment")?
If this will not help, switching to Local system account on services.msc should work for you.
Post Reply