A virtual machine from Windows Server 2012 R2 cannot be directly imported into Windows Server 2012. This is discussed in this previous post along with the import error 32784 .
There will be times when we want to take a 2012 R2 VM and import it into 2012, this happened to me recently when setting up one of the workshops that I deliver to customers. While the setup guide said to deploy 2012 R2, what was installed was another story as the setup team had not prepared 2012 R2 builds for this environment.
So what to do?
While the 2012 R2 VM configuration file cannot be imported into 2012, the virtual hard disk can be reused!
This post will walk through reusing the original VHD with a new 2012 configuration file. We will assume that the VM in question is a generation 1 VM, since generation 2 VMs were first introduced on 2012 R2! Please note that the intent of this post is to provide workaround steps for lab or test VMs, and is not intended to be taken as a supportability statement.
We will focus on one VM that is called EMSDC and is currently stored in the C:VMs-EXT folder. This is the location where the VM should reside so there is no need to move files around.
The files on disk are shown below. Note that the directory structure is pretty straightforward and that there are only two files:
The files that you see are the XML configuration file and the VHD virtual hard disk. If you prefer to see the directory in explorer that is also shown:
Since we cannot import the Server 2012 R2XML file, we shall back it up and then delete the original from the Virtual Machines folder.
Note that in the bottom section of the below, the F5164EF0***.XML file has been deleted.
Now that we have removed the original configuration file, we can make a new one.
Create New VM Configuration
In this example we will use the Hyper-V manager to create new a VM configuration which will reuse the original VHD.
First up, start the New VM wizard.
Specify the same VM name in the wizard. Note that the location is also entered so that we build the complete configuration in the same set of folders. You could leave the default if you wanted, but I wanted to mimic the original configuration. Note that the location path specified is C:VMs-Ext and is not C:VMs-ExtEMSDC.
Specify the memory and network configuration.
This leads to one point. You need to know what values to enter here, as this wizard has no knowledge of what the original VM was set to. Documentation to the rescue!
The default options are shown below for the connect virtual disk screen. The default is to create a brand new VHDX within the VM folder. This is not what we want as that does not contain our OS and applications from the original VM’s VHD.
Thus we have to change the options so that we will use the existing VHD. This is shown below:
Finally we complete the new VM wizard.
And it is shown in the 2012 Hyper-V manager.
If we review the settings for the VM we can see that the original VHD is attached to the IDE controller.
Referencing the original disk layout, we can see that the starting configuration XML file was removed then a new XML file was created.
At this point we can now power the VM on, though we still have work to do!
Aligning Hyper-V Integration Components
At this point it is very likely that the installed version of the Hyper-V Integration Components (IC or ICs) are not what we require. In this case the 2008 R2 ICs are installed which causes the 2012 devices to be improperly recognized. If you open device manger the below will likely be observed.
To check the Integration Component version we can look at the vmbus.sysfile
6.1.7601.17514is one of the Windows 2008 R2 IC builds. In this case we need to upgrade to a 2012 IC version. Depending upon your VM, you may need to uninstall the existing IC and downgrade them.
When updating the ICs I have had better success when the OS has had sufficient time to complete the hardware detection process. Once this process has finished, Windows will then prompt for a restart.
Be sure to wait for the hardware detection to complete. This is indicated with the prompt to restart. Be patient – you may need to wait for various services and applications to time out – and the desktop may go black as this happens.
Once restarted, log on and then align the Integration Components. Again – this example is one where the ICs need to be upgraded.
When the install has completed you will be prompted to restart:
I noted that on some of my VMs if I did not allow the initial hardware detection to complete and immediately tried to upgrade the Hyper-V Integration Components, the machine would get stuck at the Preparing to Configure Windowsscreen. This is why I would wait for the initial hardware detection to complete; and when prompted restart the VM prior to changing the Integration Components.
At this point we have a new VM configuration which uses the original VHD and the Integration Components are at the right build level. The virtual hardware inside the VM should all be recognized
One issue caused by replacing the VM configuration is that Windows sees a new NIC. This means that any static IPs inside the VM must be re-assigned. If this is done successfully Windows will prompt that you are assigned an existing IP to the new NIC and ask if you want to overwrite the configuration.