Avatar of Gavin Reid
Gavin Reid
 asked on

"Hyper V machines cannot shut down while they locked" error when I shut down a VM

Very odd thing started happening on a Hyper-V VM I have running on a Server 2016 host.  Whenever I try to shutdown the VM from Hyper-V Manager on the host I get a message saying "These selected virtual machine(s) cannot shutdown while they are locked, unless the shutdown is forced."

I've never seen this message before when shutting down a VM, anyone know what I need to change to stop this from happening? The VM is a server 2016 installation too.

Thanks
VirtualizationHyper-V

Avatar of undefined
Last Comment
Gavin Reid

8/22/2022 - Mon
RAFA

Hello,

Do you force the shutdown by command line?

THE vm has a snapshot?

From the command prompt turn off the vm with the following command and tell me if it gives you an error:

stop-vm followed by the server name

Regards...
Gavin Reid

ASKER
Hi, no I right click on the VM in Hyper-V Manager and select Shut Down. The VM does not have any snapshots. If I run that command from the VM-Host I get 'stop-vm' is not recognized as an internal or external command.

Thanks
RAFA

Hello,

run it from powershell, as administrator.
stop-vm followed by the server name

Regards...
Your help has saved me hundreds of hours of internet surfing.
fblack61
Gavin Reid

ASKER
stop-vm : Failed to stop.
'FA Domain Controller' failed to stop: The machine is locked and cannot be shut down without the force option.
(0x800704F7). (Virtual machine ID 5DC07F70-8D37-46AB-97C6-15E9D6AE4230)
At line:1 char:1
+ stop-vm "FA Domain Controller"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Stop-VM], VirtualizationException
    + FullyQualifiedErrorId : Unspecified,Microsoft.HyperV.PowerShell.Commands.StopVM
Hypercat (Deb)

Is the VM OS actually locked - as in, is there a user logged in and then has that user locked the desktop?
Gavin Reid

ASKER
Yes I think it is, it automatically locks when I end a remote session and goes back to the Ctrl Alt Delete screen. But this has always been the case and is the case on all the other Hyper V hosts I look after and this is the only one that I've ever seen this problem on, there isn't a single thing on Google about it which is really odd!
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Hypercat (Deb)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Gavin Reid

ASKER
It's our remote software (Techinline) that I use to remote onto the VM itself. If I disconnect it the server does lock itself. But all servers do that and I've never had this issue before, wonder if it's a new "feature" been added to 2016?
ASKER CERTIFIED SOLUTION
Philip Elder

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Gavin Reid

ASKER
Thank you both, it seems that logging off rather than quitting the remote session allows it to be shut down, that's fine I shall heed Philips advice and always log out in future. Thank you all.