29 Apr 2013

How to import Hyper-V VMs with compatibility issues

I recently came along some issues while trying to import previously exported or copied virtual machines for a customer. The recent admin did not document what he tried to do so far, but several of the virtual machines where in a likely “inconsistent” state. Importing those VMs using the Hyper-V Manager GUI or Powershell CMDLETS failed with different errors, but all pointed to the same root causes.

  • VM has been exported from a recent hardware with CPUs of different Generation
  • VM has been copied manually while being in a saved state
  • VM has been copied manually, while mixing up config files and snapshots from different VMs (don’t ask me how this can happen, apparently with enough beer before going to work??)

The following steps show how to get rid of most compatibility issues.

 

1. Create a compatibility report

$report = compare-VM -Path 'C:\ClusterStorage\Volume1\CMIRUW702\VirtualMachines\CF91993E-B76B-4D0D-ADFD-4D4DEDACE5A4.XML'

2. Show all incompatibilities

$report | ft -auto

3. Show first incompatibility

$report.Incompatibilities[0].Source

You should get an output showing you the root cause for incompatibilities

VMName Name SnapshotType CreationTime ParentSnapshotName
—— —- ———— ———— ——————
CMIRUW702 DEMO Clean Planned 24.11.2012 01:13:51

4. Fix the incompatibility (in this case, remove the snapshot)

$report.Incompatibilities[0].Source | Remove-VMSavedState

5. Import the VM using the modified report data

import-vm -CompatibilityReport $report

 

Being aware that there are also error situations which can’t be fixed the steps above should help to save time and nervs.