VMware Cloud Community
GoingCrazy
Enthusiast
Enthusiast
Jump to solution

Cannot convert 2566 to long[] - When Executing Custom Guest Script

Hi @all

I'm using orchestrator for a few weeks now. All works well up to now.

I want to receive some informations about a process with a pid (in my example 2566).

As written in the documentation this should work. But I think the orchestrator doesn't recognize the long type.

Are there any ideas how to resolve this?

I'm using Orchestrator on Windows Server (5.5 U1a).

Script:

var host = vm.sdkConnection;

var guestOperationsManager = host.guestOperationsManager;

var guestAuth = new VcNamePasswordAuthentication();

guestAuth.username = vmUsername;

guestAuth.password = vmPassword;

var processManager = guestOperationsManager.processManager;

var guestProcessInfo = processManager.listProcessesInGuest(vm , guestAuth , pid);

____

Error:

Cannot convert 2566 to long[] (Workflow:Get process from guest / Scriptable task (item1)#8)

Thanks Smiley Happy

0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

To pass the pid as an array instead of a single value, just change the last line of your script

from:

var guestProcessInfo = processManager.listProcessesInGuest(vm , guestAuth , pid);

  to:

var guestProcessInfo = processManager.listProcessesInGuest(vm , guestAuth , [pid]);


Notice the brackets around the pid parameter - this is the Javascript way to treat a single value as an array.


View solution in original post

0 Kudos
3 Replies
tschoergez
Leadership
Leadership
Jump to solution

moved to Orchestrator communities

0 Kudos
igaydajiev
VMware Employee
VMware Employee
Jump to solution

As far as I see processManager.listProcessesInGuest(vm , guestAuth , pid); is expecting as third parameter array of longs and not a single pid.

>

pids*number []

If set, only return information about the specified processes. Otherwise, information about all processes are returned. If a specified processes does not exist, nothing will be returned for that process.

Can you try providing array of pid's.

From provided script I am unable to see how pid variable gets initialized. Is it script input parameter. In tis case what type it is?

iiliev
VMware Employee
VMware Employee
Jump to solution

To pass the pid as an array instead of a single value, just change the last line of your script

from:

var guestProcessInfo = processManager.listProcessesInGuest(vm , guestAuth , pid);

  to:

var guestProcessInfo = processManager.listProcessesInGuest(vm , guestAuth , [pid]);


Notice the brackets around the pid parameter - this is the Javascript way to treat a single value as an array.


0 Kudos