How to KILL a Hyper-v Virtual Machine?
Posted by Brajesh Panda on May 13, 2011
All virtual machines usually run as a process instance under process “vmwp.exe”. So to kill any specific virtual machine we need to find the Process ID or Virtual Machine GUID f. Then you can use Windows Task Manager /Powershell/Commadline to kill the same
I have already mentioned how to find process id or virtual machine GUID in another post. Here it is! Now let’s go ahead kill this bumpy virtual machine. As soon as you kill the virtual machine vmwp.exe will restart the same. So if you want to turn it off use turn off parameters too.
Killing Virtual Machine Using Powershell
You can save below 3 lines in a ps1 (Powershell file) & utilize the same directly.
$VMName = read-host -Prompt “Enter Virtual Machine Name”
$kill = (gwmi -q “SELECT * FROM Msvm_ComputerSystem WHERE ElementName = ‘$VMname'” -n root\virtualization).ProcessID
Stop-Process -id $kill –F
Killing Virtual Machine Using Windows Task Manager
After you found the VM GUIDs, open up Windows Task Manager, Go to Performance Tab, Click on View Menu, Click Select Columns & make sure you select PID & Command Line.
Now from Command Line Colum find out the VMWP.exe process which is referring to the above GUID. And you can kill the process afterwards. Refer to the below screenshot