Windows – What VmWare VM is associated with a Process (pid) (on Windows Host)

virtual machinevmwarewindowswindows 10

I run several VMs on a beefy windows host. Every now and then one of the VMs goes into CPU spin mode taking up 100% of the HOST CPU.

To get the HOST and other VMs to be usable I find the mis-behaving VM, and set the processor affinity to one logical CPU and the rest of the machine is now usable.

After moving from spinning drives to solid state drives my approach to doing this stopped working. I used to use Windows Task manager to find the mis-behaving PID and then use Windows Resource Monitor disk activity to find the VM. I would see a file like:

J:\Virtual Machines\vm123\vm123-000004.vmdk

From this information, I know mis-behaving VM is vm123. After moving to SSD drives, however, I don't see any disk activity. So I need to find another way to get this information. I'm guessing the disk activity doesn't show up because the activity is often less than 1ms but I'm not positive.

For now, I'll use ProcessExplorer from Sysinternals tools at docs.microsoft.com/…/downloads/sysinternals-suite. It shows all of the handles associated with a process and the full command line of the process being run.

How can I get the VmWare VM that is associated with given PID? I'm guessing there is there a windows command or powershell command that will give me the answer.

I'm trying to find a solution that is part of a typical Windows installation and doesn't use 3rd party installed software.

Best Answer

You don't need to use Sysinternals Process Explorer; you can use Windows' built-in Task Manager to view the command-line of the vmware-vmx.exe process. You need to enable it by going to the Details tab, right-clicking on the column headings, and adding the "Command line" column. (Also, Sysinternals isn't exactly third-party software; Sysinternals is part of Microsoft.)

To obtain the command-line programmatically, see some of the answers to How do I find out command line arguments of a running program?

Another approach would be to inspect the vmware.log files to running VMs (located in the directory of the VM). The very first line will tell you what PID it uses.

Related Question