I stumbled into a problem importing a few machines that had previously been deleted from Hyper-V. All the files and configurations were still available.
Running the “Import Virtual Machine” wizard did not find any machines to import, so I wrote a few lines to import the machines via powershell:
1 2 3 4 |
$vms = Get-ChildItem -Recurse .\Hyper-V *.xml foreach ($vm in $vms) {import-vm $vm.versioninfo.filename} |
…which resulted in an error when trying to import one of the machines:
1 2 3 4 |
import-vm : Unable to import virtual machine due to configuration errors. Please use Compare-VM to repair the virtual machine. |
I had to get more information:
1 2 3 4 5 6 7 8 9 |
$vmerr = Compare-Vm -Path '.\Hyper-V\Virtual Machines\[GUID].xml' $vmerr.Incompatibilities Message Message ID Source ------- -------- ------ Virtual Hard Disk file not found. 40010 Microsoft.HyperV.PowerShell.Harddisk... Virtual Hard Disk file not found. 40010 Microsoft.HyperV.PowerShell.Harddisk... |
Virtual Disks missing. I verified that the files were present and that the paths were correct in the .xml file. This is a disk-intensive machine and therefor the vhd-files(disks) are distributed to 3 different physical harddrives.
1 2 3 4 5 6 7 8 |
$vmerr.incompatibilities.source Path ---- X:\Hyper-V\Virtual Hard Disks\[name].vhd X:\Hyper-V\Virtual Hard Disks\[name].vhd |
It seems to be assumed, that the images are present on the same volume. After moving all the images to the same location both the wizard and Import-VM worked.