tl;dr:

  • Open PowerShell As Admin.
  • Find VM's GUID.
    Get-WmiObject -Namespace root\virtualization\v2 -class msvm_computersystem | select elementname, processid, name| ft -auto
  • Kill related vmwp.exe <GUID>.
    taskkill /PID 1234 /F
  • (Only during specific scenarios/if above won't work): net stop vmms & Restart Hyper-V Server.

 

What happened?!

Someday I was in the process of shutting down an Hyper-V Virtual Machine (VM).

Surprisingly, this specific VM refused to die shutdown and hanged in there (this may happen for a number of reasons - honestly? IDK - looks like it might have something to do with RRAS & VMs).

Hyper-V-StoppingCriticalVM-Won't-TurnOFF

Hyper-V-StoppingCriticalVM-Won't-TurnOFF

Anyway, in order to shutdown the hung VM, it's just a matter of killing the related "Virtual Machine Worker Process" (vmwp.exe) that manages the VM.

  • Open Task Manager -> "Details"-tab then order the list "by Name", you will notice a bunch of vmwp.exe, with each process dedicated to a specific VM.
TaskManagerVMWPGUID

TaskManagerVMWPGUID

Each VM runs as a Special User, this User's Name is the VM's GUID (example above).

To match the GUID of a VM to the respective VM Name, Open a PowerShell As Admin prompt and type:

get-vm | fl *

Get-VM | fl *

Get-VM | fl *

The above command will list ALL your VM's properties (GUIDs included).

Just skim through the Output of the above command until you find the VM that is not responding and match it to its respective GUID.

TaskManagerEndTaskVMWP

TaskManagerEndTaskVMWP

Once you have the VM's GUID, you may now Open Task Manager and Kill the vmwp.exe process linked to the VM that is not responding.

  • Sometimes "End task" wouldn't work and the vmwp.exe process may still hang around.

If that is the case, you might have to use the hammer stop the "Hyper-V Virtual Machine Management Service" (vmms) then Restart your whole Server (unfortunately that would take down all your other running VMs).

 

3.5/5 - (6 votes)

3 comments on “[SOLVED]'Stopping-Critical' stuck Hyper-V VM

  • Pingback: 슈어맨
  • Hello Andrea Matesi.

    I have the same problem, but the Worker Process (vmwp.exe) cannot be killed (access denied).
    Is there any solution as stopping the Hyper-V Host.

    There are lot of machines running and I cannot stop the Host during the week.

    Best regards and thanks in advance.

    Pedro Sousa

Comments are closed.