Export and ... upgrade host

Written by employee #33. Posted in just going through the motions

Export and import VM from Hyper-V Manager. Host running Hyper-V server 2012R2. Hyper-V Manager running on 2012R2.

Does not work :( Source and copy have identical SID. The ‘GenerateNewId’ parameter does not change this. You avoid running all these updates again, but no way of getting round not sysprepping the imported vm. Damn.

Running a Server 2012R2 Hyper-V Server. Exported a VM and absolutely 100% failed to import the exported VM again. Looks like running a Hyper-V manager from Windows 10 is a bad place to be. So install a fresh 2012R2 - only for running the manager. Exported from a Hyper-V manager installed on a 2012R2, from a host running 2012R2 Hyper-V Server. What could go wrong with this? Export is running fine (again), and export format is version 8 again. So Hyper-V Manager is exporting a format it cannot import. That is ... beyond strange. So MS is thinking something like: Export, update host OS and then import. As the Eurovision judges from Belarus say, “nil point” (stole that quote).2016 should be able to import version 8 VMs, but have to try.

In short: Export from Hyper-V Manager and import with Powershell Import-VM cmdlet.

[bishop]: PS C:\> Get-VM
Name     State   CPUUsage(%) MemoryAssigned(M) Uptime           Status             Version 
----     -----   ----------- ----------------- ------           ------             ------- 
200-DC   Running 0           760               00:54:32.2840000 Operating normally 8.0     
206-CORE Off     0           0                 00:00:00         Operating normally 8.0

These VM was created as gen 2. Perhaps if you created a gen. 1 VM, it could be exported and importeded within the same host OS? Export a VM from Hyper-V Manager (D:\Hyper-V\SOURCE-VM). The result below.

D:\Hyper-V\SOURCE-VM\Virtual Hard Disks
26-07-2017  11:07  <DIR>  Virtual Hard Disks
26-07-2017  11:06  <DIR>  Virtual Machines
  0 File(s)  0 bytes
Directory of D:\Hyper-V\SOURCE-VM\Virtual Hard Disks
27-07-2017  10:34  14.466.154.496 SOURCE-VM.vhdx
Directory of D:\Hyper-V\SOURCE-VM\Virtual Machines<br>
26-07-2017  17:24  <DIR>  63944148-AFA3-4C34-A00D-E722B2C63DB5
27-07-2017  10:34  65.536 63944148-AFA3-4C34-A00D-E722B2C63DB5.vmcx
27-07-2017  10:34  102.400 63944148-AFA3-4C34-A00D-E722B2C63DB5.VMRS

The importen thing is the ".vmcx" file. It is apparently the substitute for the old .XML file (version 6).

Import and create new VM. Have not found a way to set the name of the new VM. There it will always have the same name as the original. Have a look at Import-VM (https://technet.microsoft.com/itpro/powershell/windows/hyper-v/import-vm?f=255&MSPPError=-2147217396) and for Type of import (https://docs.microsoft.com/en-us/windows-server/virtualization/hyper-v/deploy/export-and-import-virtual-machines) The import below, will create a new VM.

Import-VM -Path 'D:\Hyper-V\SOURCE-VM\Virtual Machines\B14DE ... 9C80.vmcx' -Copy -GenerateNewId -VhdDestinationPath 'D:\DestinationPath' -VirtualMachinePath 'D:\DestinationPath'

Please double check the different parameters in the above MS links.