Windows 8, Hyper-V, BitLocker and “Cannot connect to virtual machine configuration storage”

So I am now working at a new professional services company in South East England (Ballard Chalmers) who use Hyper-V throughout their DEV / TEST environments. I have previously been a VMWare Workstation person myself (and I still think the simplicity and ease of the user interface is unmatched) but for the foreseeable time I will be running Windows 8.1 Pro on my laptop as a Hyper-V host.

Before we get started it is worth describing my setup:

  • Windows 8.1 Pro
  • 3rd Gen Intel i7-3820QM CPU
  • 32GB DDR3 RAM
  • Two physical disk drives
    • C:\ SYSTEM – 512GB SSD (for Operating System, Files and Applications)
    • D:\ DATA – 512GB SSD (for Hyper-V Images and MSDN ISOs) (running in an “Ultra-Bay” where the Optical Drive used to be)

Now like most modern laptops I have a TPM (Trusted Platform Module) on my machine so I also have BitLocker encryption running on both my C: and D: drives (for those who are interested I barely notice any performance drop at all .. and I can still get 550 MB/s sustained read even with BitLocker enabled).

Saved-Critical – Cannot connect to virtual machine configuration storage

Now I noticed from time to time that my Virtual Machines were showing error messages when my computer started up. I noticed it here and there until Thomas Vochten (@ThomasVochten) also mentioned he was getting it every time he started his machine up.

Hyper-V Error

Note – You can get this error for all sorts of reasons, particularly if you have recently changed the Drive Letters, re-partitioned your hard disks or moved a VM. In this case I was getting the error without doing anything other than turning my laptop on!

Looking in Event Viewer (under Hyper-V-VMMS – Admin) also showed that for whatever reason the VMMS service could not read the disk information for that Virtual Machine, causing it to error out.

Hyper-V - Event Logs

Now personally I opened the VM and hit “Start” and usually the problem sorted itself out. If you re-started the Hyper-V Virtual Machine Management Service (VMMS) then this would also sort out any Virtual Machines afflicted with this. However, this was starting to annoy me .. why is this even happening?

What do you mean it only happens when you Shut Down?

The most annoying aspect of this is that it didn’t happen all the time. I love my Lenovo W530 and one of the main reasons is that the battery life kicks ass (over 10 hours between recharges is not uncommon .. and I’ve stretched it to almost 16 hours when just browsing the web and writing some documents). As a result I tend to “Sleep” my laptop most of the time. I have also occasionally performed a “Restart” when Windows Update prompts me to.

Neither a “Sleep” or a “Restart” will cause this problem on my laptop.

In fact .. this only happens if I do a “Shut Down” and then turn my laptop back on again!

I could hazard a guess why this happens, one reason could be the “Hybrid Start” feature introduced with Windows 8 / Server 2012. The premise is that the system files (Windows core application files and drivers) very rarely change, so why do we load them all into memory when the machine is started? Well, in Windows 8 they aren’t, instead a partial backup of the system memory is saved which contains all of those files pre-loaded and THAT gets refreshed straight into memory when you start up. This dramatically improves boot times (even now after almost 12 months of continual use my laptop still boots to desktop in around 20 seconds).

If you do a Restart then this doesn’t happen, instead it basically throws away that partial-memory file and loads everything fresh off the hard disk (re-creating the partial-memory file as it goes). This is why you need to do a “Restart” when you complete a Windows Update (a “Shutdown” simply won’t cut it!)

Could it be BitLocker?

So given that I was using BitLocker on the drive where my Hyper-V images are stored this was the first thing I looked at. One thing in particular I noticed was that the Hyper-V Virtual Machine Management Service (VMMS) did not have any dependencies at all on the BitLocker Encryption Service (BDESVC).

So .. was it possible that the VMMS started so quickly on the Windows platform that BitLocker hadn’t actually finished “unlocking” the D:\ drive? This would potentially cause the drive to be unreadable (hence VMMS not being able to access the folder).

I tried injecting a new dependency (yes, it requires a registry edit) to force the VMMS service to wait for BitLocker .. but sadly this didn’t work.

Could it be my Ultra-Bay Adapter?

The next obvious thing to look at was my “Ultra-Bay” (the adapter which allows me to hot-swap my second SSD where the Optical Drive was in my laptop). Personally I think these are great devices, they not only allow me to have a second full-sized 2.5” drive in my laptop but I can even hot-swap between a 512GB SSD or my DVDRW without shutting down.

The problem of course is that it sometimes appears as a “removable drive” which I can “safely remove”. Again, one theory is that the drive isn’t initialised quickly enough (or rather, the VMMS is initialised even quicker). This causes my D:\ to be unavailable for the split-second while the VMMS is loading itself into memory. The real problem here is I have no way of knowing if this is actually causing the problem.

Solution – Restart VMMS service on login

Unfortunately my solution here is not the most elegant, but it DOES work. Stopping and Starting the VMMS service doesn’t actually do anything to your Virtual Machines (if they are running, they will keep running) but it does force the Hyper-V service to re-check previously failing folder paths.

So … I simply created a Scheduled Task to stop the VMMS service and immediately start it again. Now you can do this from either PowerShell or a Command Prompt:

net stop vmms #stop the Virtual Machine Service

net start vmms #start the Virtual Machine Service

This however opens up a command prompt window, not very pleasant, so instead I created a couple of VB Scripts (VBS files) to silently run this in the background. The example code below stops the service, I was lazy and just made another file with the “start” command in it (you could be more intelligent here and do it all in one file if you want to get your VBS geek on!).

Dim objShell
Set objShell=CreateObject("WScript.Shell")
strCMD="powershell -sta -noProfile -NonInteractive  -nologo -command " & Chr(34) & "&{net stop vmms}" & Chr(34) 
objShell.Run strCMD,0

You can download a copy of those scripts from my OneDrive account here: https://1drv.ms/1ekCD8V

It was easy enough to create a Scheduled Task to run both scripts everytime a user logged in and the problem went away (it was basically restarting the VMMS service for me after logging in). On my environment at least, this was executing fast enough that by the time I opened up Hyper-V Manager the error had been sorted.

  • Eugene Ovsienko

    Thanks Martin, great article!

    I had exactly the same issue today on our Dell T320 on Windows Server 2012R2 and Bit-Locker enabled (on all drives with auto-unlock)

    I found another workaround – I just changed the Startup Type for VMMS service from Automatic to Automatic (Delayed Start). In this case I just need to wait 2-3 minutes till VMMS will start after system startup but in this case I do not get “Cannot connect to virtual machine configuration storage” messages in Hyper-V console.

  • Martin Hatch

    Yes, setting the service to “Delayed Start” works too … I’m a little impatient though and usually the first thing I do after logging in is start up my VMs 😀

  • Tomas Blomqvist

    Great article.

    To resolve this, I just created a bat file as:

    net stop vmms
    net start vmms
    start %windir%system32mmc.exe “%windir%system32virtmgmt.msc”

    Then replaced the Hyper-V Manager shortcut with a shortcut to the bat-file, and attached the Hyper-V Manager icon to it.

    Thanks a bunch.