Windows OS Hub
  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu

 Windows OS Hub / Windows Server 2019 / Hyper-V Virtual Machine Stuck in Stopping/Starting State

September 7, 2022 Hyper-VPowerShellWindows Server 2016Windows Server 2019

Hyper-V Virtual Machine Stuck in Stopping/Starting State

If your virtual machine running on Hyper-V is stuck for some reason, stopped responding, and doesn’t start/stop/reset after clicking the corresponding buttons in the Hyper-V Manager console, you can force-stop (kill) the worker process for this VM on the Hyper-V host. We’ll show you how to force restart a hang Hyper-V VMs running on Windows Server 2022/2019/2016, Windows 10/11, or Free Hyper-V Server without rebooting the entire hypervisor host and all running VMs (useful if you don’t have a Hyper-V HA cluster and Live-Migration).

Contents:
  • Hyper-V VM Stuck in the Stopping/Starting/Backing Up State
  • How to Stop/Kill a Hung Virtual Machine on Hyper-V?
  • Force Stop a Hyper-V VM with PowerShell
  • Hyper-V VM Stuck in Backing Up State
  • Hyper-V Manager Failed to Change VM State

Hyper-V VM Stuck in the Stopping/Starting/Backing Up State

Suppose, that one of your virtual machines on a Hyper-V host is stuck in the Stopping (Stopping-Critical), Starting (Starting 10%), or Backing up state.

hyper-v vm stuck in the stopping state

In this case, the guest OS stops responding, and the “Turn Off”, “Shut Down” and “Reset” buttons in the Hyper-V Manager become unavailable (grayed out), or return the following error when pressed:

The application encountered an error while attempting to change the state of VM.
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

If your Hyper-V does not show the list of registered virtual machines in the Hyper-V Manager console and returns the “Connecting to Virtual Machine Management service” error, you need to restart the vmms.exe (Hyper-V Virtual Machine Management service) process. This is a safe operation and will not interrupt running VMs. The easiest way to restart the vmms.exe process of the vmms service is through the services.msc console or with the PowerShell service management cmdlets:

Get-Service vmms | Restart-Service

posh: restart-service vmms

How to Stop/Kill a Hung Virtual Machine on Hyper-V?

The only way to force shutdown/restart such a stuck VM without rebooting the whole Hyper-V host is to kill its worker process on the host OS. All VMs on a Hyper-V host are started using the vmwp.exe process instances (Virtual Machine Worker Process). To find a specific process PID, you need to find out the GUID of the virtual machine.

You can get the VM GUID using the Hyper-V Manager console. Open the Hyper-V server settings. The Server section contains the directory where the VM configuration files are stored (in our case it is D:\VMStore).

Hyper-V Settings

Open this directory in File Explorer and find the folder with the name of your stuck virtual machine. Copy the GUID that is specified in the name of the VM configuration file with the *.vmcx extension.

vm guid in file name

Run the Task Manager and go to the Details tab. All virtual machines are running under their own instance of vmwp.exe process. 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 that has the GUID of your VM in the User name column. Kill this VM process (End Task).

kill hung vm on hyper-v using task manager

Similarly, you can find and stop a hung virtual machine process on a Hyper-V host using the Process Explorer tool.

  1. Run Process Explorer as administrator and click Find Handle or DLL (or press Ctrl-F);
  2. Specify the path to the virtual disk (*.vhdx) of the Hyper-V VM that is stuck in the starting/stopping state;
  3. Process Explorer will list all processes that are using the virtual machine VHDX file;
  4. Locate the vmwp.exe virtual machine process and kill it (Right-click -> Kill Process).kill vmwp.exe hyper-v vm worker process with proc explorer
    Previously, we showed you how to use Process Explorer to find and unlock files that are locked by other processes.

The virtual machine will be forcibly stopped. Now you can do whatever you want with VM.

Force Stop a Hyper-V VM with PowerShell

It’s much easier to find and kill the not responding virtual machine process using PowerShell. Run the PowerShell console as an administrator (your account must be a member of the Hyper-V “Hyper-V administrators” group).

In this case, the built-in Stop-VM cmdlet from the Hyper-V PowerShell module will not let you shut down the VM. If you try to run the Stop-VM -Forcecommand, it also hangs. Obviously waiting for a response from the VM.

You need to kill a VM process by its GUID. You can get the VM GUID by its name. For example, to get the GUID of the VM with the name SVM-GUARDEDHOST1, run the command:

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

If you don’t want to type the full name of the VM, you can list all the VMs registered on this Hyper-V host and their ID:

Get-VM | Select VMName, VMId, path

get vmid with powershell

Copy your VMID from the resulting list.

Find the vmwp.exe process identifier (PID) for this VMGUID:

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

Then you must forcefully terminate the process of a hung Hyper-V virtual machine, using the Stop-Process command:

Stop-Process ($VMWMProc.ProcessId) –Force
Killing Hung VM on Hyper-V using Powershell

Tip. We also have a simple guide on how to kill a stuck VM on VMWare ESXi.

Hyper-V VM Stuck in Backing Up State

When backing up a VM on a Hyper-V host, you may experience the Hyper-V VM stuck in the Running state with the Backing up status. However, you cannot stop or start the VM through Hyper-V Manager.

hyper-v vm freez in backing up running state

If you do not want to reboot the Hyper-V host, check the status of the “Microsoft Hyper-V VSS Writer” service first:

vssadmin list writers

Make sure that the command doesn’t return an error. You must then restart the “Hyper-V Virtual Machine Management” service using the PowerShell command:

Get-service vmms | stop-process
Make sure the vmms.exe process has ended. If not, force it to terminate:

Get-Process | Where-Object { $_.ProcessName -eq 'vmms' } | Stop-Process

Now you can start the Hyper-V management service:

Start-Service vmms
Restarting the Virtual Machine Management service should reset the status of VSS Writer on the Hyper-V host.

Hyper-V Manager Failed to Change VM State

Sometimes it happens that even after killing a hung-up VM process, you cannot turn on the VM. Moreover, it freezes in the Starting state with an error:

Virtual Machine Connection
Failed to Change State.

In this case, check the following options:

  • Check that there is enough free space on the disk on which the Hyper-V VM files are stored;
  • If an ISO image is connected in the VM settings, check if this image file is available at the specified path;
  • Check the network adapter settings of the VM. Virtual network adapters must be connected to an existing Hyper-V virtual switch (there must be no status Network Adapter – Configuration Error for any NIC);hyper-v network-adapter configuration error
  • Check that the Hyper-V Virtual Management Service (VMMS) is running and didn’t stuck in the Stopping state;
  • Make sure that your antivirus software doesn’t block access to VM files. Add paths to the VM directory to the antivirus exclusions (see hot add exclusions to the built-in Windows Defender antivirus on Windows Server);
  • Check for Hyper-V related errors in the Event Viewer -> Applications and Services Logs -> Microsoft -> Windows -> Hyper-V-Worker;
  • Disable sleep and hibernation on Virtual Machine guest operating systems. You can disable sleep in Windows via Control Panel –>Power Options -> Change plan settings -> Put the computer to sleep -> Never. To disable hibernation and sleep in an Ubuntu Linux guest OS, run the command:
    systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

If the methods above didn’t help, it looks like you’ll have to reboot the entire Hyper-V host.

13 comments
5
Facebook Twitter Google + Pinterest
previous post
Disable Web Search Results in Windows 10/11 Start Menu
next post
Start Menu or Taskbar Search Not Working in Windows 10/11

Related Reading

Configuring Event Viewer Log Size on Windows

May 24, 2023

How to Detect Who Changed the File/Folder NTFS...

May 24, 2023

Enable Single Sign-On (SSO) Authentication on RDS Windows...

May 23, 2023

Allow Non-admin Users RDP Access to Windows Server

May 22, 2023

How to Create, Change, and Remove Local Users...

May 17, 2023

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMWare
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • Configuring Event Viewer Log Size on Windows

    May 24, 2023
  • How to Detect Who Changed the File/Folder NTFS Permissions on Windows?

    May 24, 2023
  • Enable Single Sign-On (SSO) Authentication on RDS Windows Server

    May 23, 2023
  • Allow Non-admin Users RDP Access to Windows Server

    May 22, 2023
  • How to Create, Change, and Remove Local Users or Groups with PowerShell?

    May 17, 2023
  • Fix: BSOD Error 0x0000007B (INACCESSABLE_BOOT_DEVICE) on Windows

    May 16, 2023
  • View Success and Failed Local Logon Attempts on Windows

    May 2, 2023
  • Fix: “Something Went Wrong” Error When Installing Teams

    May 2, 2023
  • Querying Windows Event Logs with PowerShell

    May 2, 2023
  • Configure Windows LAPS (Local Administrator Passwords Solution) in AD

    April 25, 2023

Follow us

  • Facebook
  • Twitter
  • RSS
Popular Posts
  • How to Install Windows 11 on a Hyper-V Virtual Machine?
  • How to Install and Configure Free Hyper-V Server 2019/2016?
  • USB Device Passthrough (Redirect) to Hyper-V Virtual Machine
  • Poor Network Performance on Hyper-V VMs in Windows Server 2019
  • Windows Cannot Find the Microsoft Software License Terms
  • How to Install VMWare ESXi in a Hyper-V Virtual Machine?
  • Import, Export and Clone Virtual Machines in Hyper-V
Footer Logo

@2014 - 2023 - Windows OS Hub. All about operating systems for sysadmins


Back To Top