0

Hyper-V Encountered An Error While Loading The Virtual Machine

When I was running Windows 8 I ran into an issue importing VMs with the error “Did Not Find Virtual Machine To Import” and discussed it on the blog.   The presence on the .exp file was causing the import to fail.  Since I had to rebuild my corporate laptop, I hit a related the same thing in Windows 8.1 but with a different error message.

Importing the same set of lab VMs to Windows 8.1 gave me a different error:

Hyper-V encountered an error while loading the virtual machine configuration.  Importing the virtual machine from file  <GUID>.exp failed.  The operation was passed a parameter that was not valid.

Since the last post was based of Oasis, let’s pay homage to the other Britpop icon of the 90’s – Blur.

Bang !

<Courtesy link to Blur>

Since my SSD took a dive like an Italian football player in the penalty box, I had to rebuild my laptop.  The previously running VMs were on a second SSD but could not be exported gracefully.     After correcting the hardware issue, installing Windows 8.1 and then installing the Hyper-V feature it was time to get the lab VMs back up and running.  After all, if I did not run any VMs what is the point of carrying the beast that is a Lenovo W530 around?

Starting to import the VM went swimmingly

Windows 8.1 Hyper-V Import VM Wizard - Select Folder

So good so far

Windows 8.1 Hyper-V Import VM Wizard - Select VM

Still good:

Windows 8.1 Hyper-V Import VM Wizard - Select Import Type

And then we are the lucky winner of the big fat error below:

Windows 8.1 Hyper-V Import VM Error - The operation was passed a parameter that was not valid

There’s No Other Way

<Courtesy link to Blur>

OK so we got an error and we can see that is relates to the .exp and the wizard also tells us exactly where it is located.  This is a great improvement to the previous behaviour on Windows 8.  Checking the contents of the folder shows that there is indeed an .EXP file present:

Windows 8.1 Hyper-V Virtual Machines Folder Contents

Out of curiosity I wanted to see what was being accessed on the file system, so our trusty friend Process Monitor came out to play!

In the above error message it states that we ran into an issue with the .exp file.  What was slightly puzzling initially was that there are no individual lines in the Process Monitor output that shows we were accessing the .exp file but we must have to generate the error.  The previous example is here.

Click to enlarge the capture below.

Windows 8.1 Hyper-V VM Import File System Activity

The import process is looking for the presence of the file, its just a little more hidden that the previous example!  Unlike the previous post where Windows 8 Hyper-V performs actions to the .exp file as Windows 8 / Server 2012 support importing VMs using the legacy WMI API this is not the case with Windows 8.1 / Server 2012 R2.  The Windows 8.1 import process enumerates the contents of the Virtual Machines directory.  You can see this in the right hand detail column:

image

As in the previous post, let’s archive the .exp from the Virtual Machines folder and then re-try the import process.  You can see that the .exp is no longer present.

Windows 8.1 Hyper-V Virtual Machines Folder Contents - No EXP File

Since the Hyper-V import Wizard parses the folder structure and already knows about the .exp file we need to restart the wizard.  Else you will get the same error.

Song 2

<Courtesy link to Blur>

After archiving the .exp, we can restart the wizard and successfully complete the import process.

Windows 8.1 Hyper-V VM Import Completed Sucessfully

Now the curious readers out there will be thinking “how did he manage to get into this state in the first place?  How is that .exp file present when the VM was previously running on Windows 8.1?” Well that’s a good question.

Normally I do not use the GUI to do imports as I have too many VMs, the Import-VM cmdlet is used instead.  PowerShell has a slightly different VM import behaviour.

In the below example, note the .exp file is present.  Import-VM must be told which .xml file to import, it is not pointed at a directory and parses the .xml directly.

image

You can see this in Process Monitor – the import completes before any IO is performed on the .exp file.

Cheers,

Rhoderick

Rhoderick Milne [MSFT]

Leave a Reply

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