Q: How can I stop a Hyper-V virtual machine?

How to kill the process for a Hyper-V VM.

John Savill

January 16, 2012

1 Min Read
ITPro Today logo in a gray background | ITPro Today

A: Each virtual machine (VM) has its own worker process in the parent partition (your Windows Server 2008/2008 R2 server with Hyper-V role enabled). Most likely that worker process has hung or experienced a problem.

The solution is to kill the process for the worker process for that VM. A new worker process will automatically be launched when you start the VM again.

To find the process ID for the worker process for the hung VM, you can use Windows PowerShell. In the command below, replace with the name of your VM that has hung:

(Get-WmiObject -q "SELECT * FROM Msvm_ComputerSystem WHERE ElementName = 'MyUnresponsiveVM'" -n rootvirtualization).ProcessID

For example, I typed the command

PS C:>(Get-WmiObject -q "SELECT * FROM Msvm_ComputerSystem WHERE ElementName = 'savdalclient.savilltech.net'" -n rootvirtualization).ProcessID

and it returned 6168 as the process ID.

You can then kill the process with this command:

Stop-Process -Id     

Here it's used in my example:

Stop-Process -Id 6168

and I received this:

Confirm

Are you sure you want to perform the Stop-Process operation on the following item: vmwp(6168)?

[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y

You would type Y to confirm you want the process to stop.

 

Need more help? Still got issues? Check out all of the FAQs for Windows by John Savill.

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like