Hyper-V – Windows 10 Hyper-V Client with VMs hosted on Bitlocker drives causing Kernel-Power events

Just a quick tip today.  There are many of use running Hyper-V client on our Windows 10 PCs for development and testing purposes.  If you, like me, have all your VMs hosted on a disk that has been protected with Bitlocker you’ve probably been through the pain of VMs that have lots of strange issues when booting.  The most common of which was the Ethernet card failing to load on start up with errors like:

Microsoft Synthetic Ethernet Port (Instance ID {C549AG45-5925-49C0ADD2-218E70A4A1EA}): Failed to power on with Error ‘The system cannot find the path specified.’ (0x80070003). (Virtual machine 5412BD43-DC85-31CB-A688-1B29CE2C57C8)

The good news is with Windows 10 build 1609 most of these issues have been sorted out.  However I’ve recently come across one that was bugging me.  A couple of the VMs on my host are configured to “save state” when the host shuts down.  And when the host restarts the VMs auto start.  Nothing special here.  However I noticed that the VMs when started kept reporting “Unexpected Stop” and “Kernel-power” events reported in Event Viewer.  So what is going on.

After a bit of prodding around I’ve worked it out, it looks like good old BitLocker is still causing some issues with VMs hosted on BitLockered drives.  From what I can work out is the BitLocker service is shutting down before the Hyper-V save process has completed.  This means that the VMs loose their saved state and thus report the unexpected stop when you next boot them.

To get around this I’ve created a very simple batch file that runs a bit of PowerShell that stops the VMs before the host is shutdown.

Batch file:

powershell -file “c:\batchfiles\shutdownvms.ps1”
shutdown -s -f -t 15

PowerShell file (PS1)

get-vm | where {$_.State -eq ‘Running’} | stop-vm

I said it was simple!

Create a desktop shortcut to the batch file, remember to set the shortcut to run “As administrator” so the PowerShell runs properly.

No more errors on VM boot….happy days!

 

Leave a Reply

Your email address will not be published. Required fields are marked *