One of the popular topics lately has revolved around the Hyper-V Did Not Find Virtual Machines To Import error. This issue can arise when we try and import a VM into Windows Server 2012 R2 or 8.1 which was originally exported from Windows Server 2008 or 2008 R2. Such exported VMs from 2008 or 2008 R2 use a .exp file to hold the exported VM's configuration. The issue is discussed in detail in the previous post, but one item that was worth teasing out was how to get the VMs into a state where they can be imported easily into Windows Server 2012 R2 or 8.1 without discarding the old VM configuration.
This is important as chances are there are many people out there with VMs exported from Windows Server 2008 or 2008 R2 that they will want to re-use in the future. Consider the scenario where you have just finished installing 8.1 and you then realise that the old VMs will not import. Do you really want to:
Wipe Windows 8.1 Install Windows 8 Import the VMs Copy off the VM files Wipe Windows 8 Install Windows 8.1 Import VMs
Backing up data, re-installing apps and applying Windows Updates is also likely in the above scenario, but the above list is enough to illustrate the point….
Hopefully the answer is no. So what to do? Well as Travis suggested in a comment we can use the Windows boot to VHD feature to get a parallel install on Windows running where we can perform the intermediate import task. All this this can happen without impacting our main installation of Windows.
In this example we will have a machine running Windows Server 2012 R2. As discussed 2012 R2 and 8.1 cannot import a VM which was exported from Hyper-V 2008 or 2008 R2. We will:
The steps are interchangeable for Windows 8.1 and 8. So feel free to install Windows 8 into the VHD, this walkthrough uses Server 2012 instead.
Before embarking on the below, please make sure you have read and understood all the options at the bottom of the previous post.
The steps in this article are only necessary if you do not have any other Windows 2008 R2, Windows 8 or Server 2012 machines. If you still have one of those machines your legacy (.exp) exported VMs can be imported without having to do the above. Once imported simply copy over the VM folder to Hyper-V 2012 R2 or Windows 8.1
We will create a VHD on the root of the C:\ drive whilst running Server 2012 R2. Note the start menu button to indicate that the below image is from 2012 R2. This VHD will hold the OS for the copy of Windows 2012, and since we install Windows 2012 to the VHD the Server 2012 R2 installation will not be modified! For more details on boot to VHD scenarios check out TechNet.
Open up Computer Management, then navigate to Disk Management. Right Click and select Create VHD.
Note that the VHD must be sufficiently large to hold the new Windows 2012 install with pagefile etc. If you want to copy the VM to import to this partition later then allow additional space. Alternatively leave the VM on a USB disk and attach that once the parallel copy of Windows is up and running.
In the Create and Attach Virtual Hard Disk window specify the options below, though the disk size can be increased as mentioned above.
In this case we shall make a VHD of 60 GB at the root of C:\.
No need to do anything else to the VHD, next we will restart Server 2012 R2, boot off the DVD and install Server 2012 into the VHD just like it was a normal hard disk. Well almost…
Restart the host machine to boot from the Windows 2012 DVD, and click Install now.
Lets select Windows Server 2012 Standard with GUI. Again note this is Server 2012 --- not the R2 build!
Review and accept the license terms.
This will be a custom install since it is a fresh installation of Windows. Remember the intent is not to interfere with the running copy of Server 2012 R2. Also upgrading 2012 R2 to 2012 would be slightly strange…..
Press Shift + F10 to activate the command prompt. This party trick goes back to Windows 2000 days. Prior to that there was the browse for LMHosts file in NT and from the browse window you could run cmd.exe and get a cmd prompt. I digress…
You will need to ensure that you know what drive letter the Win-2012.VHD file is now on. It will not be on C:\ so check the drive letters so you know where it is. Once this is confirmed proceed to the next step. In the example here it is on D:\ but other systems will be different.
In the command prompt we will use Diskpart.exe to mount up the VHD file that was prepared in the Windows Server 2012 R2 environment. Run the following:
Diskpart.exe
Select VDisk=D:\Win-2012.vhd Attach VDisk
Select VDisk=D:\Win-2012.vhd
Attach VDisk
Make sure that the Attach VDisk command was entered, else the disk will not be visible.
Click Refresh, and the VHD will appear. Double check that the size is what we expect, 60 GB to ensure we do not install to the wrong partition, select this disk for the Server 2012 installation and click Next.
Ignore the error stating that “Windows can’t be installed on this drive”. For reference the details are:
Windows 2012 will install and do its thing….
Go get a coffee or Ardbeg depending upon what time it is or your preference…
Once installed, boot to the Windows 2012 installation.
We will need to install the Hyper-V role. Using PowerShell run either:
Add-WindowsFeature Hyper-V –IncludeManagementTools –Restart
Or
If copying files from a Bitlocker encrypted disk, also install the Bitlocker feature run:
Add-WindowsFeature Hyper-V,Bitlocker –IncludeManagementTools –Restart
Hyper-V will be installed, and Windows will restart automatically.
Now we are ready to import the legacy (.exp) VMs into our temporary Server 2012 installation. They do not need to be powered on or anything, this is only to import them.
Here is the Server 2012 install. For confirmation, note there is no start button.
Attach, copy or do whatever is necessary to get your old VM files onto this machine. In the below screenshot we see a VM called AD1HC1 that was copied to the C:\Working folder.
This VM’s directory structure is shown below.
Note the .exp file which indicates that it was exported from Windows Hyper-V 2008 or 2008 R2. Also note there is no XML file for the vm – only config.xml exists.
In the Hyper-V console, right click the server name start the VM import wizard.
Browse to the folder containing the VM, and click Next.
Confirm the VM name, and if correct click Next.
When importing a VM in the newer versions of Hyper-V there are different options to import a VM in place. Since we are using Windows 2012 we have these options. Hyper-V 2008 R2 had different ones.
In this case the files are where I want to use them, so lets use the Register option to suck them up as-is.
Click Next.
The import wizard completes. Click Finish.
The legacy VM is now imported into Hyper-V 2012.
The VM is now imported and is visible in the Hyper-V interface. There is no need to power on, since we just need to use this process to convert the VM to a format that can be imported to Windows 2012 R2 Hyper-V .
The export process in Windows Hyper-V 2012 is pretty much a straight file copy so we can either:
Remember in this example we copied a VM called AD1HC1 to the C:\Working folder. So we need to copy over the contents of this folder to the original Windows 2012 R2 OS.
If your VM files were located on an external USB disk this makes things easy. Once the files are where you need them restart and boot into Windows Server 2012 R2.
Now that we are back into Windows Server 2012 R2 (note the start button is present), we are able to import the converted VM files.
One thing to note, check that there is no .exp file present in the VM folder that you are going to import to Hyper-V 2012 R2. This was discussed in a previous post. You will get an error if this is present.
Fire up the Hyper-V import wizard, and navigate to the folder that contains our converted files. In this case I copied the VMs from C:\ Working to a USB disk that is now mounted as F:\.
Select the VM and click Next.
Confirm the VM name, and click Next.
As before we have the options below when importing, chose as appropriate and click Next.
The wizard completes, and click Finish.
At this point the VM has been successfully imported.
To prove that it works here is the VM running on Windows 2012 R2. Note that the creation date is the 19th of February 2010 and the VM has all of its original configuration.
Job done
Now if you want to keep the Server 2012 install on the VHD that's fine. If you want to remove it, the steps are below.
When done with the import and export work we can easily remove the temporary Windows Server 2012 installation by:
While this is a couple of steps to go through there are a couple of points that are worth noting:
Cheers,
Rhoderick
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!
US
Canada
For all other areas please use the US contact point.
Would be a heck of a lot easier if MS would just release some sort of utility that could easily fix this...just saying.
it's a pity the code to import 2008 r2 vm's was removed in 2012 R2, as it existed in 2012 anyway, and 2008 r2 isn't that old
Instead of reinstalling windows 8/2012 on your physical machine why not just run up a VM install windows 8 on that and then add the hyper-v role there? You can see how to do this from this post (not mine) http://rmlinar.net/blog/2013/01/29/hyper-v-role-inside-hyper-v-virtual-machine/You can't start the VM but you would be able to import/export it. So you dont have to rebuild the Host again in 8.1/2012r2Might save you two quite major steps :)
This is one of the reasons I just hate working with Windows. When everything looks so nice, Microsoft always remind us of his problems and incompatibilities with it's own products.
Speightz - It is an interesting notion. I didn't use that as I wanted the process to be as native as possible and using the fully supported path. With boot to VHD, the original OS is still there it is not wiped and the effort will be similar.Omar - Yes this is not ideal, though this should be a one time deal and there are a lot of benefits with the new import/export method provided buy the WMI2 provider one you are running in the newer versions... Cheers,Rhoderick
Speightz, thank you. Your idea is the brightest thing in this very sad story. As a software developer, former full-time MSFT, now MCT - I continue to be very dissapointed by software Microsoft creates. What is the justification of not providing automatic conversion during import, or at least official downloadable tool? You completely ignore people using your software.
I had the same problem but fixed it by creating a temporary Windows 2012 hyper-v guest and activated hyper-v in this guest. This is possible and will work since the VM only needs a import and exporte and not a start.I posted a small description here: http://systemspecialist.net/2014/03/23/solution-windows-8-1-hyper-v-did-not-find-virtual-machines-to-import/
thank you for the post some correction: --- Run the following: ... Select VDisk=D:\Win-2012.vhd --- but on the printscreen right version Select VDisk file=D:\Win-2012.vhd
I haven't tested personally myself but Cesare's and Speightz's ideas should be the shortest path until MS releases a convert utility.
Why can't we just import without all this? Seriously are the guys behind writing win server / hyper V that inapt?
Isn't the 2008R2 configuration in a readable xml format? In other words, if looking into bulk migrations, in Powershell. It might be easier to just read the xml and recreate the VM using the readout and vhd's attached?