Posted on April 18, 2017 · Posted in Hyper-V, Windows Server 2016

How to Stop a Hung Virtual Machine on Hyper-V 2016

If your virtual machine running on Hyper-V  has hung up for some reasons, stopped to respond and doesn’t start/stop/reset after clicking the corresponding buttons in Hyper-V console, the only way out is to kill the process responsible for this VM on the host OS. We’ll show how to do it on Hyper-V running on Windows Server 2016.

Suppose, that one of your Hyper-V VMs has hung up, the guest OS doesn’t respond and Turn Off, Shut Down and Reset buttons in Hyper-V Manager either are unavailable, or return the following error:

The application encountered an error while attempting to change the state of …

Failed to change state

The operation cannot be performed while the object is in its current state

The application encountered an error while attempting to change the state of … Failed to change state The operation cannot be performed while the object is in its current state

To force stop/restart this VM  without the restart of the whole host server, you have to end the process of this VM. To do it, you need  get the GUID of the virtual machine.

Open  Hyper-V Settings of Hyper-V Manager. In Server section, the location of the VM config files is shown (in our case it is D:\VMStore).

Hyper-V Settings

Go to this directory and locate the folder with the same name as your virtual machine has. Remember the GUID specified in the name of the VM configuration files name.

vm guid in file name

Start Task Manager and go to Details tab. All virtual machines are running in their own instance of vmwp.exe. To determine which process is responsible for your VM, you need the GUID of the hung-up VM you obtained earlier. Find the process vmwp.exe with this GUID shown in User name column. End this process (End Task).

kill hung vm on hyper-v using task manager
The virtual machine will be stopped. Now you can do anything with it.
But! It’s much easier to find and end the process of the hung-up virtual machine using PowerShell. In this case, we’ll need only its name.

Get the GUID of the VM with the name SVM-GUARDEDHOST1:

$VMGUID = (Get-VM "SVM-GUARDEDHOST1").ID

Find the identifier of vmwp.exe for this VMGUID:

$VMWMProc = (Get-WmiObject Win32_Process | ? {$_.Name -match 'VMWP' -and $_.CommandLine -match $VMGUID})

Force this task to stop using Stop-Process:

Stop-Process ($VMWMProc.ProcessId) –Force

Killing Hung VM on Hyper-V using Powershell

This is the way to easily forcefully terminate the working process of a hung-up Hyper-V virtual machine.

Tip. We also have the description of the same procedure to kill the process of the hung-up VM on VMWare ESXi.

Previous:
Next:
Related Articles