VMware Cloud Community
GarTomlon
Enthusiast
Enthusiast
Jump to solution

Gather running processes and PIDs

I have a VM running Windows 10.  I would like to have a workflow that gathers and outputs the running processes and PIDs.  This output could simply be System.log("Process Name").  This will need to be an array and be able to reference the process name (assign to a variable).  Any help would be appreciated.  Thanks Tom

Reply
0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

The following sample code shows how to enumerate running processes and print their PID and name:

var procman = vm.sdkConnection.guestOperationsManager.processManager;

var procs = procman.listProcessesInGuest(vm, new VcNamePasswordAuthentication(false, vmUsername, vmPassword));

for each (var p in procs) {

  System.log("Process pid: " + p.pid + "  name: " + p.name);

}

Input parameters are vm (of type VC:VirtualMachine), vmUsername and vmPassword.

View solution in original post

Reply
0 Kudos
1 Reply
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

The following sample code shows how to enumerate running processes and print their PID and name:

var procman = vm.sdkConnection.guestOperationsManager.processManager;

var procs = procman.listProcessesInGuest(vm, new VcNamePasswordAuthentication(false, vmUsername, vmPassword));

for each (var p in procs) {

  System.log("Process pid: " + p.pid + "  name: " + p.name);

}

Input parameters are vm (of type VC:VirtualMachine), vmUsername and vmPassword.

Reply
0 Kudos