How to Stop an Unresponsive Hyper-V Virtual Machine

It doesn’t happen that often but sometimes Hyper-V virtual machines (VM) hang when you are trying to shut them down. And you end up with a VM in Hyper-V Manager with a status of ‘Shutting down’ that no longer responds, and it can’t be forced to shut down using the normal controls. Even the PowerShell Stop-VM -Force command doesn’t help.

In this situation, you need to be more creative about shutting down the VM. One way is to shut down your server (or PC if you are using client Hyper-V). But that’s something of a sledgehammer solution. The most important thing you need if you want to force an unresponsive VM to shut down, is the VM’s GUID. Using the GUID, you can find the VM’s CPU process ID and kill it.

Force a Hyper-V virtual machine to shut down by killing its process

Using the method below is only recommended if the VM is not responding to a shutdown command from Hyper-V Manager or using the PowerShell Stop-VM -Force command. The following commands must be run in Windows PowerShell as a local administrator. The method below requires Windows PowerShell. It doesn’t work in PowerShell 6 or later versions.

In an elevated Windows PowerShell prompt, start by using Get-VM to find the VM’s GUID. You will need to know the name of the unresponsive VM to do this. If you need to confirm the VM’s name, just run Get-VM to see a list of all the VMs running on the device.

Sponsored Content

Passwords Haven’t Disappeared Yet

123456. Qwerty. Iloveyou. No, these are not exercises for people who are brand new to typing. Shockingly, they are among the most common passwords that end users choose in 2021. Research has found that the average business user must manually type out, or copy/paste, the credentials to 154 websites per month. We repeatedly got one question that surprised us: “Why would I ever trust a third party with control of my network?


Once you have the VM name, run the command below, replacing ‘Windows 11’ with the name of the VM you want to stop:

$VmGUID = (Get-VM 'Windows 11').id

The next step is to use Get-WMIObject to find the process ID of the VM. Here we use the Win32_Process Windows Management Instrumentation (WMI) namespace to find a running CPU process that matches vmwp.exe and the GUID ($VmGUID) of our virtual machine.

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

Once we have the process ID ($VMWMProc), we can use the Stop-Process cmdlet to kill it:

Stop-Process ($VMWMProc.ProcessId) –Force
Unresponsive Hyper-V
How to Stop an Unresponsive Hyper-V Virtual Machine (Image Credit: Russell Smith)

Force all VMs to shut down

The other way you can force a VM that isn’t responding to shut down is to stop the Hyper-V service. But this method will forcibly shut down all running VMs on your server. Just as with the previous method, you need to run the following command in an elevated PowerShell window, i.e. one that has local administrator privileges.

Get-Service vmms | Restart-Service

Restarting the Hyper-V service (vmms) can take quite a while. So, don’t worry if it takes several minutes to stop and then restart it again.

Related Topics:


Don't have a login but want to join the conversation? Sign up for a Petri Account

Comments (0)

Leave a Reply

IT consultant, Contributing Editor @PetriFeed, and trainer @Pluralsight. All about Microsoft, Office 365, Azure, and Windows Server.