Tuesday, June 7, 2016

Error Importing Hyper-V Virtual Machine

I regularly get Hyper-V VMs for use developing course materials. Our environment is pretty standardized, so, there are seldom any issues. However, today when running our import script, I got the following error for several of the VMs in a new course:
Import-VM : Unable to import virtual machine due to configuration errors. Please use Compare-VM to repair the virtual machine.
So, I ran Compare-VM and placed the output in a variable for easier viewing:
$report=Compare-VM -Path .\GUID.xml
The mystery was solved when I looked at the incompatibilities property in the output:
$report.incompatibilities

The incompatibilities showed that a a virtual network was missing:
Message: Could not find Ethernet switch 'Cluster Network'.
MessageID: 33012
Source: Microsoft.HyperV.PowerShell.VMNetworkAdapter

When I took a look at my virtual networks, I saw that the script I ran to create the virtual networks created Cluster_Network instead of "Cluster Network". After I renamed the network, then all was good.