Hyper-V Did Not Find Virtual Machine To Import


Since I have this lovely Lenovo W530 laptop with a couple of disks and 32GB of RAM, it is great to run VMs on!  As you can imagine, I have multiple different Exchange labs to reflect all the different versions and builds that are in use.  Generally I have been able to import all of my older VMs into Hyper-V on Windows 8 and 2012 with no issues.  But as you probably have guessed by now, if I had not ran into something this blog post would not be needed………

Update 22-10-2013:  If trying to import a Windows Server 2008 R2 VM into Windows Server 2012 R2 or Windows 8.1 please also see this post

Update 10-1-2014:    Updated error message is present in Windows 8.1.  Please see this post

 

What’s The Story, Morning Glory?

<Courtesy link to Oasis>

The machine we will look at is an Exchange ActiveSync emulator running Windows Mobile 6.5, but that’s not too relevant.  I copied the files over to the C:\VMs folder, and then went to import the VM using the wizard:

 

Windows 8 Hyper-V Virtual Machine Import

 

   We can see the files have been copied over:

Hyper-V VM Copied to Destination Folder

 

Now lets import the bad boy into Hyper-V:

 

Windows 8 Hyper-V Virtual Machine Import

          

As the Eurovision judges from Belarus say, “nil point” Sad smile 

Hyper-V Did Not Find Virtual Machines To Import From Location

In the Microsoft-Windows-Hyper-V-VMMS/Admin event log we can see that an error was logged.

  • Event Source: Hyper-V-VMMS
  • Event ID: 18364
  • Event Body: The virtual machine configuration could not be read: Unspecified error (0x80004005).

The error is stating that Hyper-V is a smidge unhappy with the configuration it is trying to import.

Hmmm.  That’s a trifle annoying, isn’t it?  So let’s go get this fixed!

 

Don't Look Back in Anger

<Courtesy link to Oasis>

Taking a look at the directory structure, we see the following:

           

Hyper-V Virtual Machine Directory Structure

 

Looks like we have all the files, no?  There are VHD, export and some config type files.

 

Cracking open the World’s #1 troubleshooting tool, Process Monitor from Sysinternals, let’s trace to see what is going on at the file system level.  Maybe there is a deny NTFS permission ??

 

When firing up Process Monitor, it will capture a lot of data by default.  A lot.  So much so that we will need to tweak the capture filter to make it easier to parse the results.  When Process monitor is opened up, either click the magnifying glass icon or press Ctrl + E to stop the capture.  The magnifying glass icon will then have a red cross to indicate it is not capturing.

Process Monitor Showing Capture Option

Then we can click onto the filter icon or press Ctrl + L to specify our custom filter.

 

Process Monitor Showing Filter Option

 

In this case we know that the VM files are located in “C:\VMs\EAS VM” so let’s filter on that:

Process Monitor Filter Set to Hyper-V VM Directory

 

Click Include then add to include the path filter, then click OK.  You will see a new row with a green icon at the top of the filter view (not shown above).  Now that our filter has been saved let’s clear the screen with Ctrl + X.

We will then click the magnifying glass to start the capture, and then re-do the VM import that originally failed.  When the import fails, stop the capture with Ctrl + E.

          

 

Process Monitor Showing VM Import Failing

 

As you can see, there are no access denied messages.  You can search for that easily in larger captures with Ctrl + F and searching.

 

What is interesting is that Hyper-V is looking at the .exp file and then moving on to the .xml file.  Hmm, wasn’t that one of the neat new features?  In Windows 2012 Hyper-V — we do not have to specifically export a VM before it can be imported.  So why are both files here? Since I know that this VM was originally exported from a Windows 2008 R2 Hyper-V machine the .exp file is what is expected.

 

So lets backup and then remove the .xml file from the directory, and then re-do the import.  Note I said backup and not nuke, just in case!!  What happens now?

Directory Structure Showing .xml File Removed

 

With the .xml file removed the import wizard is able to parse the VM and moves on to the next screen:

Hyper-V VVirtual Machine Import

 

A couple more clicks to finish the wizard and then success!  The VM was successfully imported!  In the Process Monitor capture the .exp is processed and no errors are reported.

 

Process Monitor Showing Successful VM Import

 

 

Champagne Supernova

<Courtesy link to Oasis>

After removing the spurious .xml file I was able to import the VM.   Note that there are other causes for the same error being raised.  The exact fix will depend on the version of Hyper-V.

As mentioned above each new release of Hyper-V has added new capabilities, and if we focus on just the VM import/export aspect:

Windows 2008 R2 Hyper-V added additional features when importing and exporting VMs, namely:

  • Copy On Import – Can choose a different directory to import to.  Windows 2008 required admins to copy the VM package to the final destination and import from there.
  • Export Snapshot – Can export just a single snapshot from the snapshot history as a complete VM.
  • Fine grained Control – improved APIs to provide control over import & export operations.  Note that Configuration Only Exports are now done only via the API in Windows 2008 R2.

Windows 2012 Hyper-V removed the dependency on the .exp file.  In Windows 2008 and 2008 R2, a VM must have been exported before it could be imported.  This is a great feature for admins, and the following was a common scenario.  Why do we want this you ask?

Say that your lab Windows 2008 R2 Hyper-V host lost the RAID1 OS array, and you were left with only the RAID 5 array containing the VMs.  Because the VMs were not manually exported before the OS mirror failed, you could not just import them.  Backups of the VMs would be great, but not all lab VMs are backed up for example.  Sure you could create new VMs and attach the existing .vhd files to the new configurations but that means re-doing the IP addresses and depending on the OS having to clear out the old IP and NIC configuration.  How many times have I had to use KB 241257 with the command devmgr_show_nonpresent_devices=1 to purge stale NICs from a VM.

In Windows 2012 Hyper-V the VMs can be imported as-is – how neat is that?

 

One more thing to add on the Sysinternals topic.  You can go to live.sysinternals.com and directly download the tools that you want.  This is very handy if you know exactly what you want.

 

Cheers,

Rhoderick

Technorati Tags: ,
Comments (24)

  1. anonymouscommenter says:

    Hi

    Great article and very informative

    Shouldn't say the "With the .xml file removed", instead of .exp, where the .exp still exist according to the picture of the Command Prompt Window?

    best regards,

    Thorkell

  2. Hi Thorkell,

    Thanks for the pointer – that section was also missing its image so added that back too!!

    Take a peek at please let me know how that looks.

    Cheers,

    Rhoderick

  3. anonymouscommenter says:

    Hi Rhoderick

    Looks great now !!

    Thanks again for a good article

    Cheers,

    Thorkell

  4. Hi Thorkell,

    Thanks for confirming.  I have a related post in draft – should get it finished this week or early next week.

    Cheers,

    Rhoderick

  5. Great post Rhoderick.

    Not sure if you have noticed but Windows 8.1 fails to import VMs exported from 2008 R2. I think it might be a glitch that will be fixed before RTM but wanted to let you know in case you can find some workaround! 🙂

  6. Hi Bhargav!

    Hope you are doing well!  I have not had the time to upgrade my corp machine to 8.1, but want to do it for the copy & paste Hyper-V feature.  If I get some time, I'll upgrade one of my 2012 Hyper-V clusters to 2012 and see what I can repro.

    For what you were doing, did you export the VM from 2008 R2 and it has the exported structure, or was it importing directly in the new host without exporting first please?

    Cheers,

    Rhoderick

  7. anonymouscommenter says:

    I've run in the same problem as Bhargav Shukla on Windows 8.1. So for now, I'll just reconnect the .vhd/x file(s) and hope that it'll run somehow…

  8. anonymouscommenter says:

    In 2012 R2 import does not work on VMs exported from 2008 R2, from either .exp or .xml.

  9. Hi folks,

    Got some time to look into to this, and yes we cannot import a Windows 2008 R2 VM directly to windows 8.1 or to Windows Server 2012 R2.  

    Just to confirm that you can build a new machine and leverage the existing vhd ?

    Cheers,

    Rhoderick

  10. henkvdweerdt@hotmail.com says:

    Got the same problem over here. Cannot import any VM into Win2012R2 that are from Win 2008R2. Will try the VHD trick

  11. henkvdweerdt@hotmail.com says:

    Just tried the following method:

    – Backup old Vhdx from win2008r2

    – Copy the vhdx to the virtual machine folder

    – Create same network configuration as on old win2008r2 hyper-v host

    – Create a new Vmware on win2012r2 machine

    – Attach copied vhdx harddisk to image

    – Start the machine.

    It worked!

  12. Hi folks,

    As always thanks for the comment and feedback – much appreciated !!!

    Got a little bit more time, so added a write-up here:

    blogs.technet.com/…/windows-hyper-v-2012-amp-8-1-hyper-v-did-not-find-virtual-machine-to-import.aspx

    Cheers,

    Rhoderick

  13. anonymouscommenter says:

    Hi Rhoderick!

    I wanted to thank you for the write-up; it helped me find the fix in 2012 R2.

    So it seems the way to move a VM from 2008 R2 to 2012 R2 is to:

    Run the Export wizard on the 2008 R2 host

    Find the .exp file within the Virtual Machine folder > delete it

    Find the original Virtual Machine folder, copy the .xml file from within to the newly created Virtual machine folder

    Then run the 2012 R2 import wizard against the parent folder created by the export wizard

    Works every time so far!

  14. anonymouscommenter says:

    One of the popular topics lately has revolved around the Hyper-V Did Not Find Virtual Machines To Import

  15. anonymouscommenter says:

    One of the popular topics lately has revolved around the Hyper-V Did Not Find Virtual Machines To Import

  16. anonymouscommenter says:

    Hi Evan,

    You should be able to shutdown the VM, stop the Hyper-V management service to unlock the files and copy the package over. If the VM is on a LUN or removable disk, shut the host down and move the disk – that’s another way to achieve the same thing.

    I don’t advocate fnangling with the files and editing the XML etc, as that is something that the product group will not support. We need to manage via the supported interfaces.

    Cheers,
    Rhoderick

  17. anonymouscommenter says:

    When I was running Windows 8 I ran into an issue importing VMs with the error “Did Not Find Virtual Machine

  18. anonymouscommenter says:

    One of my favourite features in Windows 8 is client side Hyper-V. This allows me to run multiple virtual

  19. anonymouscommenter says:

    Good afternoon!
    I wonder how do I convert a VHD to XVA if someone can help me because I’m migrating from citrix for hyper-v

  20. Monkey12345678 says:

    This would help me a lot, but I only have the .VHD file, and it won’t import. How to fix?

  21. @Monkey – Create a new VM, but do not create a VHD as your go through the new VM wizard. Once you are done, open up the VM settings, and add your original virtual disk to this new config.

  22. anonymouscommenter says:

    I am also encountering the same issue in Windows 8.1 …did we able to get the fix for the same ?

  23. anonymouscommenter says:

    also I can only see .exp file in the folder list …cant find any .XML file …. plz share ur thoughts/help …. .thanks

  24. George says:

    After I removed the .xml file from exported VM from Windows 2008 R2, import to Windows 8.1 failed with the same error message: Hyper-V Did Not Find Virtual Machines To Import

Skip to main content