We’ve recently run into an issue where, following Windows Updates and a reboot, 2016 Hyper-V servers are unable to connect to the vmms service and don’t display any VMs in the Hyper-V console.
If Hyper-V is in this state following a reboot with no VMs showing it may be that the saved states of the virtual machines have become corrupted.
To recover from this, you need to replace the corrupted VMRS files in your Virtual machine folder.
First let’s try stopping the Virtual Machine Management service.
Which will inevitably fail to stop and need to be ended by task manager.
Then navigate to your “Virtual Machines” folder.
You should have pairs of .vmcx and .VMRS files for each VM on your Host.
The VMRS files should normally either be very small (around 130KB) for turned off machines or the size of Memory assigned to the VM for running machines.
If the file was corrupted whilst saving during a shutdown it will likely be somewhere in between these two values. These are the files we’re looking for!
Next rename the extension for all of these corrupted VMRS files to something that won’t be loaded by Hyper-V.
I’ve gone with: .VMRS.old
If you started up VMMS now you’d no longer get “Connecting to Virtual Machine Management service…” and instead will get:
Here’s where we need our good VMRS from a shutdown machine.
Paste the VMRS into the Virtual Machines folder and rename it to match the old VMRS.
You’ll then need to copy the security permissions from the old file onto the new one. The easiest way to do this is using PowerShell. You can use the built in Get-ACL and Set-ACL commands or use this helpfully put together Copy-ACL command https://devblogs.microsoft.com/powershell/copy-acl/
Once all the corrupted VMRS files have been replaced we can start the Hyper-V Virtual Machine Management service again. Once started you should see these new files almost immediately jump up in size to match the VMs memory allocations.
And hopefully your Hyper-V Manager will now look more like this:
Still to test:
It may be possible to use a blank file with the correct permissions and name as a replacement for the VMRS file.
This hasn’t yet been tested but when I get an opportunity, I’ll update this post to reflect the result. If you do test this send an email and let me know how you got on!