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.
<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
So good so far
And then we are the lucky winner of the big fat error below:
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:
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.
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:
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.
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.
After archiving the .exp, we can restart the wizard and successfully complete the import process.
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.
You can see this in Process Monitor – the import completes before any IO is performed on the .exp file.
If you would like to have Microsoft Premier Field Engineering (PFE) visit your company and assist with the topic(s) presented in this blog post, then please contact your Microsoft Premier Technical Account Manager (TAM) for more information on scheduling and our varied offerings!
If you are not currently benefiting from Microsoft Premier support and you’d like more information about Premier, please email the appropriate contact below, and tell them you how you got introduced!
For all other areas please use the US contact point.
I was busy with songs for awhile:)
but hyper-v stuff also good:)
Oops! Maybe I need to add a disclaimer about lost productivity :)
Worked great. Had the same issue after my W520 SSD was replaced. I re-named my exp file to .old Thanks.
Hi, what if I only have the vhd file and not the .exp or .xml, can I still import the vhd?
Take a look at this post please:
The section to take a peek at is
Create New VM – Reuse Virtual Hard Disk
Worked great! Had the same issue moving from 2012 to 2012 R2
Very helpful Article. Saved me valuable time.