Bobcares

How to kill ‘Hyper-V VM Stuck in the “Stopping/Starting” State’

by | Nov 27, 2020

The only way out to fix ‘Hyper-V VM Stuck in the “Stopping/Starting” State’ is to forcibly kill the process responsible for this VM on the host OS.

As part of our Server Management Services, we assist our customers to fix similar errors.

Let us see how we restart stuck Hyper-V VMs running on Windows Server 2016/2019 without rebooting the entire host and all running VMs.

 

Hyper-V VM Stuck in the “Stopping/Starting” State

For instance, one of the Hyper-V VMs is stuck in the Stopping (Stopping-Critical) or Starting (Starting x%) state;

Hyper-V VM Stuck in the “Stopping/Starting” State

Here, the guest OS doesn’t respond. The “Turn Off”, “Shut Down” and “Reset” buttons in the Hyper-V Manager is either unavailable or return the following error:

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.

 

Hyper-V Manager Stuck on “Connecting to Virtual Machine Management Service”

If our Hyper-V does not show virtual machines in the Hyper-V Manager console, and returns the “Connecting to Virtual Machine Management service” error, we need to restart the vmms.exe process.

This is a safe operation and will not interrupt the running VMs. The easiest way to restart the vmms.exe process is through the vmms service using the services.msc console or with the PowerShell service management cmdlets:

Get-Service vmms | Restart-Service

 

How to Kill a Hung VM Process in Task Manager

The only way to force a shutdown/restart a stuck VM without rebooting the whole Hyper-V host is to end its running workflow in the guest OS.

All VMs on the Hyper-V host starts using the vmwp.exe process. To search for a process, we need to find out the GUID of the virtual machine.

We can get the VM GUID through the Hyper-V Manager console. Open the Hyper-V server settings. In the Server section, the location of the VM configuration files is shown.

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

Run the Task Manager and go to the Details tab. All virtual machines are running in their own instance of vmwp.exe.

To determine which process is responsible for our VM, we need the GUID of the hung-up VM obtained earlier.

Locate the process vmwp.exe that has the GUID of our VM in the User name column. Kill this process (End Task).

The virtual machine will be forced to stop.

[Need help to kill a Hung VM Process in Task Manager? We are available 24*7]

 

Killing a Frozen Hyper-VM using PowerShell

It is easy to find and kill the process of the hung-up virtual machine using the PowerShell CLI. We need to run the PowerShell console with the administrator privileges.

In this case, the built-in Stop-VM cmdlet will not let us shutdown the VM. If we try to run the Stop-VM -Force command, it also freezes, awaiting a response from the VM.

We also need to kill the VM process by its GUID. We 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 we do not want to type the full name of the VM, we can list all the VMs registered on this Hyper-V host:

Get-VM | Select Name, Id

Copy the VM GUID 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, using the Stop-Process command, we must force-terminate this process:

Stop-Process ($VMWMProc.ProcessId) –Force

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

 

Hyper-V: Failed to Change VM State

Sometimes it happens that even after killing a hung-up VM process, we 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, we check the following options:

  • Check that there is sufficient 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 its availability;
  • 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);
  • Check that the Hyper-V Virtual Management Service (VMMS) is running and did not stuck in the Stopping state;
  • Make sure that the antivirus software does not block access to VM files;
  • Add paths to the VM directory to the antivirus exclusions;
  • Check for Hyper-V related errors in the Event Viewer -> Applications and Services Logs -> Microsoft -> Windows -> Hyper-V-Worker.

[Still facing the error? We are here for you.]

 

Conclusion

In short, if our virtual machine running on Hyper-V is stuck for some reason, the only way out is to forcibly kill the process responsible for this VM on the host OS.

Today, we saw how our Support Engineers resolve this error for our customers.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF