Monday, April 4, 2016

Killing a Hung VM in Task Manager (Another PowerShell command)

This is another command of how to kill a Hung VM by identify the Process ID using PowerShell command :

image

For Windows 2012

Get-WmiObject -Namespace root\virtualization -class msvm_computersystem | select elementname, operationalstatus, processid, name| ft –auto

For Window 2012 R2

Get-WmiObject -Namespace root\virtualization\v2 -class msvm_computersystem | select elementname, operationalstatus, processid, name| ft –auto

Once the Process ID is obtain, launch the Task Manager and kill the VMWP.exe process with the correspondence Process  ID to that particular VM.

image

Hope this helps.

keywords : hang VM, hung VM, stuck VM, Hyper-V virtualization stuck Server 2012 R2, vmwp.exe, killing vwmp.exe

Killing a Hung VM in Task Manager

Sometimes the VM we tried to stop hangs.  So in order to kill the process using the Task Manager, we can end process of VMWP.exe.  But the next question is which one.  Each VM has a unique Process ID.

image

Therefore, I launch the elevated Powershell by executing the following command below

Get-WmiObject win32_process -Filter "Name like '%vmwp%'" | Select-Object ProcessID, @{Label="VMName";expression={(Get-VM -Id $_.commandline.split("")[1]|Select-Object VMName).VMName}}|ft –AutoSize

image

So I go back to the Task Manager and Right-Click on it and end task,base on the Process ID of that particular VM.

image

Hope this command helps you as it helped me.

keywords : hang VM, hung VM, stuck VM, Hyper-V virtualization stuck Server 2012 R2, vmwp.exe, killing vwmp.exe