< Blog

How to Shut down VMs and Restart a Hyper-V Server When You Can’t Logon

By Joseph Yedid

In yesterday’s post, Please Wait for the Local Session Manager, you may recall that Garth Jones and I had an issue with not being able to logon to one of our Hyper-V servers. For some reason the Local Session Manager was timing out during logon attempts. Boy was that frustrating.

Before we attempted to do anything to the server itself, I had to shut down all the VMs that were running. Figuring out how to go about it without being able to logon was the tricky part.

Luckily, we had two options.

Although we couldn’t logon to the server, everything else seemed to be working. Hyper-V Manager connections from our workstations seemed to be working and a Virtual Machine Manager (VMM) server was up and running off site.

Being a more robust tool, we used VMM to shut down the VMs. Personally, VMM is my favorite VM management tool.

Here’s what we did:

In the VMs and Services workspace, expand All Hosts and select the server you want to work on.

How to Shut down VMs and Restart a Hyper-V Server When You Can’t Logon-Expand All Hosts

If necessary you can select multiple VMs from the list and then select Shut Down from the ribbon.

How to Shut down VMs and Restart a Hyper-V Server When You Can’t Logon-Shut Down

With all the VMs now turned off, I had to find a way to shut down the server itself.

Through trial and error, I discovered that the only way to shut down a server that you can’t log into is to do it remotely, and the simplest way is from a command line prompt: shutdown /m \\<server name> /r /t: 0

The shutdown switches explained:

/m \\<server name> – Specifies the computer you want to connect to.
/r – Specifies you want to reboot.
/t – Specifies the amount of time before the shutdown begins.

Once the server came back up I was able to ensure that all the VMs were able to start up again.

Success!