What is a generation 1

Convert Hyper-V Generation 1 VM to Generation 2 VM

I am always asked how a generation 1 VM can be converted into a generation 2 VM under Hyper-V. Officially this is not possible:

However, if the guest operating system in the VM to be converted meets the requirements for a generation 2 VM:

The Convert-VMGeneration Script from John Howard (Senior Program Manager in the Hyper-V Team at Microsoft) can help in many cases. The script can be found under the following link:

https://code.msdn.microsoft.com/ConvertVMGeneration

It is important to mention that neither Microsoft nor John Howard provide support for this script, i.e. you should ensure that your VMs and your entire environment are adequately backed up before you start the conversion.

First the VM to be converted has to be started. There must be in an administrative prompt via the command:

reagentc / disable

Deactivate the Recovery Agent console:

Then the guest operating system in the VM must be shut down.

A PowerShell window with administrative rights must now be started on the Hyper-V host.

There, by entering:

Set-ExecutionPolicy –ExecutionPolicy unrestricted

the execution policy adjusted:

The conversion process can then be started by entering the following:

. \ convert-vmgeneration.ps1 -VMName "WS2012R2Gen1" -Path W: \ VMs

In my example, the VM with the name "WS2012R2Gen1" is converted and the generation 2 VM is to be stored under "W: \ VMs":

The script creates a new generation 2 VM which takes over the settings of the original generation 1 VM. A new virtual hard disk is also created for the new generation 2 VM. In order to transfer the data from the virtual hard disk of generation 1 VM to the virtual hard disk of generation 2 VM, both virtual hard disks are mounted on the host:

Check the mounted hard disks on the host system as indicated in the output of the conversion script:

In my example, disk 3 will be completely overwritten - so please manually check whether this is correct via e.g. the disk management.

After confirming with "Y" the script continues to work. Depending on the data volume and storage throughput, it will now take some time for the conversion to be completed.

After completing the process, there is a new virtual machine of type Generation 2 - in my example "WS2012R2Gen1 (Generation 2):

The original generation 1 VM is retained, but should be deleted after the generation 2 VM has been successfully tested.

Now start the generation 2 VM created by the conversion and log in. Open a command prompt in the VM console and execute the following command:

reagentc / enable

I am a freelance trainer and IT consultant. As a Microsoft Certified Trainer and Microsoft Senior PreSales Consultant, the focus of my work is on client and server operating systems from Microsoft. In this capacity, I work for Microsoft myself, but also for other companies such as Fujitsu or Lenovo as well as many well-known Microsoft partner companies.