Windows OS Hub
  • Windows Server
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2012
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Group Policies
  • Windows Clients
    • Windows 10
    • Windows 8
    • Windows 7
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
  • PowerShell
  • Exchange
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2012
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Group Policies
  • Windows Clients
    • Windows 10
    • Windows 8
    • Windows 7
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
  • PowerShell
  • Exchange

 Windows OS Hub / Hyper-V / How to Stop a Hung Virtual Machine on Hyper-V 2016

April 18, 2017 Hyper-VWindows 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.

7 comments
1
Facebook Twitter Google + Pinterest
previous post
Exchange Error “452 4.3.1 Insufficient system resources”
next post
Managing Default File Associations in Windows 10

Related Reading

Configuring SSO (Single Sign-On) Authentication on Windows Server...

January 29, 2019

How to Inject Drivers into a Windows 10...

January 15, 2019

How to Enable Access-Based Enumeration (ABE) on Windows...

January 8, 2019

Licensing Mode for Remote Desktop Session Host is...

December 7, 2018

Remote IIS Management in Windows Server 2016/2012 R2

November 30, 2018

7 comments

Sergey Mozhzhukhin December 6, 2017 - 8:11 pm

It’s easy to kill VM but it doesn’t start anymore if you do this. You have to restart host.

Reply
Tim N April 13, 2018 - 12:51 pm

I tried to kill the VM this way and it said access denied, even though I was logged in as the administrator!

Reply
Max April 16, 2018 - 9:19 am

Ensure that your account is a member of the local group Hyper-V administrators and you have started elevated PoSh console.

Reply
ZEP June 27, 2018 - 8:23 pm

Never had luck with this on Server 2012r2. I always end up rebooting the host to fix the issue.

Reply
Hyper-V マネージャー 停止中 重大 - Blog - MarvelWorks August 1, 2018 - 6:34 am

[…] 下記の海外サイトで、プロセスを特定して停止させようとするケースは、VMが起動しているが、 反応がないフリーズした状態の時のみ有効のようです。 http://woshub.com/how-to-stop-a-hung-virtual-machine-on-hyper-v-2016/ […]

Reply
Himanshu Pawar August 6, 2018 - 1:59 pm

If Its Windows 10 pro Test environment machines , Just remove the feature restart host system and add Hyper v feature again your VM will be showing in saved state just Add Virtual switch and add to the VMs for those you were facing problem in startup.Now delete the save state and start the VM you will get your machine ready.

Reply
Jan Laursen September 7, 2018 - 9:08 am

Thank You – was just about to throw my host machine out the window 🙂

Reply

Leave a Comment Cancel Reply

Categories

  • Active Directory
  • Group Policies
  • Exchange
  • Windows 10
  • Windows 8
  • Windows 7
  • Windows Server 2016
  • Windows Server 2012 R2
  • Windows Server 2008 R2
  • PowerShell
  • VMWare
  • MS Office

Recent Posts

  • ESXi: Slow Disk Performance on HPE Gen8

    February 15, 2019
  • Integrating Windows Updates into Windows 10 Install Image

    February 12, 2019
  • Copying Large Files over an Unreliable Network Using BITS and PowerShell

    February 11, 2019
  • Fix: Clock Reverts to Wrong Time After Computer (Server) Reboot

    February 8, 2019
  • Fix: BSOD Error 0x0000007B on Boot on Windows 7 and Server 2008 R2

    February 7, 2019
  • How to Disable Automatic Driver Updates in Windows 10?

    February 6, 2019
  • WSUS Windows Update Error 0x80244010: Exceeded max server round trips

    January 31, 2019
  • Configuring SSO (Single Sign-On) Authentication on Windows Server RDS

    January 29, 2019
  • Unable to Start or Connect to Virtual Disk Service in Disk Management

    January 28, 2019
  • How to Inject Drivers into a Windows 10 WIM/ISO Install Image?

    January 15, 2019
woshub.com

Follow us

  • Facebook
  • Twitter
  • RSS
Popular Posts
  • Hyper-V PowerShell Direct in Windows Server 2016
  • VHD Set: Shared Virtual Disks on Hyper-V 2016
  • Production Checkpoint in Hyper-V 2016
  • Using Differencing Disks in Hyper-V for Quick VM Deployment
  • Detecting Memory Overcommitment in the Guest OS
  • How to Install Hyper-V Role in Windows 10 VM under VMWare ESXi
  • Configuring Hyper-V Live Migration without Failover Clustering
Footer Logo

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


Back To Top