View previous topic :: View next topic |
Author |
Message |
spike05
Joined: 04 May 2015 Posts: 4
|
Posted: Wed Mar 29, 2017 6:55 am Post subject: Shell Script: Error: Invalid result (ÿþ2 |
|
|
I've a script that count the number of used citrix licenses.
Code: |
$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? |
|
Back to top |
|
|
KS-Soft Europe
Joined: 16 May 2006 Posts: 2832
|
Posted: Wed Mar 29, 2017 8:03 am Post subject: |
|
|
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. |
|
Back to top |
|
|
spike05
Joined: 04 May 2015 Posts: 4
|
Posted: Wed Mar 29, 2017 8:17 am Post subject: |
|
|
Hello,
The SScript_UseWindowsPipe= wasn't present in the file. I added the line
Quote: |
[misc]
SScript_UseWindowsPipe=1
|
and tested with a 1 and a 0 no success
edit:
even something as simple as
Code: | echo "ScriptRes:Ok:Test Ok" |
Returns the error |
|
Back to top |
|
|
KS-Soft Europe
Joined: 16 May 2006 Posts: 2832
|
Posted: Wed Mar 29, 2017 8:27 am Post subject: |
|
|
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: | $statusOk = "ScriptRes:Ok:"
$statusBad = "ScriptRes:Bad:"
$res = "noData"
echo $statusOk$res |
What is test Status and Reply with this script? |
|
Back to top |
|
|
spike05
Joined: 04 May 2015 Posts: 4
|
Posted: Wed Mar 29, 2017 8:34 am Post subject: |
|
|
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
Quote: | [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 |
|
Back to top |
|
|
KS-Soft Europe
Joined: 16 May 2006 Posts: 2832
|
Posted: Wed Mar 29, 2017 2:13 pm Post subject: |
|
|
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. |
|
Back to top |
|
|
spike05
Joined: 04 May 2015 Posts: 4
|
Posted: Wed Mar 29, 2017 11:22 pm Post subject: |
|
|
I've tried, but i'm getting the error "Unable to start script. A required privilege is not held by the client" |
|
Back to top |
|
|
KS-Soft Europe
Joined: 16 May 2006 Posts: 2832
|
Posted: Thu Mar 30, 2017 3:31 am Post subject: |
|
|
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. |
|
Back to top |
|
|
|