Killing a wedged virtual machine

While I would like to pretend that nothing ever goes wrong with Hyper-V – the fact of the matter is that sometimes things go wrong with the best systems.

Hyper-V has been designed in a modular fashion so that you can easily address any problems without affecting other virtual machines.  But there can be a problem in figuring out what to do when things go wrong.  Imagine that on my server the “FTP Server” has stopped responding – and I cannot even turn it off:


What I need to do is to kill the vmwp.exe process for the FTP Server.  But how do I know which one to kill?  Thankfully I can figure this out with a single line of PowerShell:

(gwmi -q "SELECT * FROM Msvm_ComputerSystem WHERE ElementName = ‘FTP Server’" -n root\virtualization).ProcessID

Which will tell me exactly which one needs to be killed:


Now I can simply kill the vmwp.exe with a process ID of 2932 and restart the FTP Server.