0

I've been running HyperV on 2012R2 until EOL and never encountered this problem. New hardware, installed Windows Server 2022 Standard. Created two VMs, doing the same thing as before, one webserver application with links to a database and license server running on the second VM. All good, except shutdowns. Using Hyper-V manager (on the host) I can connect to the VMs and I can execute a shutdown on each - But even after an hour, Hyper-V manager reports their state as "Stopping", not stopped or Off.

How do I get the VMs to shutdown normally? What is causing this very extensive delay in the shutdown of the VMs?

Following the suggestions on other threads - Executing a Restart on the Host results in being stuck at a screen which reads "Shutting down Service: Hyper-V Virtual Machine Management" for hours. Eventually the machine restarts and everything seems normal. Until the next time I need to do an update and restart the VMs and Host. I would like the VMs to shutdown without getting stuck at "stopping".

One suggestion to solve this from another thread Server 2016 Running Hyper-V Stuck in "Shutting down service: Hyper-V Virtual Machine Management" was that the VM's swap drive needed to be on their own local C drive. This is the case for these VMs but it is not the case for the Host. The Host swap space is on a separate drive with a separate controller. Anyone else find this stuck stopping problem with shutdown of VMs where the Host swap drive is on a different controller/drive? If others are seeing this same issue maybe Microsoft can be made aware of this correlation and fix this issue.

And yes I know, I should conduct a test where I reconfigure the location of the swap drive on the Host and see if that removes the VM's stuck stopping problem. However, it's a production server and I'm not fond of conducting experiments on it.

deuxbits
  • 1
  • 1
  • 2

1 Answers1

1

You could try to run a PowerShell script before you restart which does a shutdown of the VMs.

# Get all running virtual machines
$runningVMs = Get-VM | Where-Object {$_.State -eq 'Running'}

Stop each virtual machine

foreach ($vm in $runningVMs) { Stop-VM -VM $vm }

Perform the server reboot

Restart-Computer -Force

But the best practice is that you have two or more hyper-v host, and that you live migrate (and thus empty the host of VMs) and then reboot.

Turdie
  • 2,945