VMware {code} Community
tgc1
Contributor
Contributor

vmware-vmx PID in Server 2

Hi!

Is there any method in VIX (or any other valid API) to get the PID of a guest?

This was possible with VMControl API (VMControl_VMGetPid), but VMControl

seems to be removed in Server 2.

Teppo

Reply
0 Kudos
4 Replies
fixitchris
Hot Shot
Hot Shot

What does the method do?

Reply
0 Kudos
tgc1
Contributor
Contributor

In Server 1.0.x this method was able to return the Process ID of the

virtual machine process (at least in Windows host):

Bool VMControl_VMGetPid(VMControlVM *vm, unsigned int *pid); But in Server 2 the VMControl API doesn't seem to work any more.Actually it wasn't too public API even with Server 1.0.x. The only "documentation" I found of this API was here: http://jeff.bovine.net/VMWare_vmcontrol_API I use the PID to monitor the load and other properties of specificvirtual machine process from host. I could search all the Process Ids with the name "vmware-vmx.exe", but I also need to identify theguest behind the Process ID when there are multiple guests running.

Teppo 
 

Reply
0 Kudos
fixitchris
Hot Shot
Hot Shot

What language are you coding in?

If you look at a vmware-vmx.exe process under vmware-hostd.exe in Process Explorer (sysinternals.com) you can get the PID there. Open up the vmware-vmx.exe process and look at the command line, it'll show you the VMX path as well. I also see the PID in the vmware.log for that machine:

Jan 21 08:50:08.087: vmx| Log for VMware Server pid=4708 version=2.0.0 build=build-122956 option=Release

I tried looking up a PID variable with read variable for all 3 types of variable but did not return anything...

See: http://communities.vmware.com/thread/29783

tgc1
Contributor
Contributor

I'm using C and C++.

Unfortunately using the log file is not stable enough or even possible solution. I can't be sure if there are multiple VMs started at the same time for example after reboot and then

there are again multiple PID lines to check in the log.

Another problem is that the account running the code doesn't necessarily have any access to the log file. The account is very limited log-on-as-service-only non-admin account.

The idea of using the command line was sounding very good. Too bad, it seems that a non-admin account doesn't have any access to see the command lines of other users' processes and the vmware-vmx is running with SYSTEM account. Even the Sysinternals Process Explorer was unable to show the command lines in this case.

But thank you, this was very promising idea.

Teppo

Reply
0 Kudos