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.


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.

  • I first tried to use the Task Manager and enable the command-line, but the line is too long and there isn't a way (that I know of) to get all of the information. If there is please let me know. I think this is the simplest approach. And agreed, Sysinternals is fine. – PatS Mar 25 at 3:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.