Migrating virtual machines between different Windows 11 Hyper-V hosts or restoring virtual machines from raw backup folders frequently leads to import failures. When an imported virtual machine references hardware configurations that do not exist on the target host—such as differently named virtual switches, unavailable physical paths, or conflicting processor compatibility settings—standard graphical import tools fail with generic error messages. PowerShell provides a robust programmatic pipeline to overcome this challenge through the paired cmdlets Compare-VM and Import-VM.
The Compare-VM cmdlet generates a comprehensive compatibility report detailing every mismatch between the exported VM configuration and the destination hypervisor. Administrators can fix incompatibilities programmatically within the report object before committing the final import using Import-VM.
Understanding Hyper-V Import Modes and Compatibility Verification
Hyper-V supports three distinct import operational modes:
- Register in-place: Registers the virtual machine configuration using existing directory files without copying or moving virtual hard disks. This mode preserves original file locations and keeps the existing unique identifier (GUID).
- Restore: Copies the exported virtual machine files to designated host locations while keeping the original virtual machine GUID. Suitable for restoring an exported machine back to its original host.
- Copy (Generate New ID): Duplicates the virtual machine files and assigns a brand-new unique GUID to the imported instance. Essential when importing multiple instances of a template VM to prevent identifier collisions on the host network.
When migrating across different hardware environments, incompatibilities commonly arise from missing Virtual Switch attachments (e.g. source host uses “ProductionSwitch” while target host uses “Default Switch”), processor architecture differences, or missing virtual hard disk file paths.
Auditing Virtual Machine Files with Compare-VM
Open an elevated PowerShell console on Windows 11 and identify the path to the exported virtual machine definition file (.vmcx or legacy .xml):
# Specify path to exported VM definition file
$ExportPath = "D:\VMExports\SQLServer-01\Virtual Machines\B2A5D8E4-1234-4567-89AB-CDEF01234567.vmcx"
# Generate compatibility report without applying changes
$Report = Compare-VM -Path $ExportPath
Inspect the generated report object to evaluate whether the target Windows 11 host can run the virtual machine without modification:
# Check compatibility state and error flags
$Report.Incompatibilities | Format-Table -Property MessageId, Message, Source
If $Report.Incompatibilities is empty, the destination host matches all required parameters, allowing immediate execution of Import-VM -CompatibilityReport $Report. If errors are present, they will display specific Message IDs (such as 33012 for missing virtual switches).
Resolving Missing Virtual Switch Incompatibilities
The most common failure encountered during Hyper-V migration is an unmapped virtual network adapter. Compare-VM allows administrators to re-bind the disconnected virtual NIC directly inside the compatibility report.
Inspect available virtual switches on the current Windows 11 machine:
# List local Hyper-V virtual switches
Get-VMSwitch | Select-Object Name, SwitchType, NetAdapterInterfaceDescription
Locate the incompatible network adapter in the report and assign it to an existing local switch:
# Retrieve the incompatible virtual network adapter
$NIC = $Report.Incompatibilities[0].Source
# Inspect current broken connection
$NIC.SwitchName
# Connect the network adapter to the local host's active switch
Connect-VMNetworkAdapter -VMNetworkAdapter $NIC -SwitchName "Default Switch"
Re-evaluate the compatibility report to ensure the network incompatibility is resolved:
# Re-test compatibility after fixing network bindings
$Report.Incompatibilities | Format-Table -Property MessageId, Message
Updating Storage and Virtual Hard Disk Paths
If the exported machine references drive letters or storage paths that do not exist on the target host (such as an inaccessible E:\Storage\ volume), re-point the virtual hard drive paths inside the report:
# Identify hard disk drive objects with missing paths
$Report.VM.HardDrives | Select-Object ControllerType, ControllerNumber, ControllerLocation, Path
# Re-assign hard drive path to valid local directory
Set-VMHardDiskDrive -VMHardDiskDrive $Report.VM.HardDrives[0] `
-Path "C:\Hyper-V\Virtual Hard Disks\SQLServer-01_OS.vhdx"
Importing the Virtual Machine
Once all entries in $Report.Incompatibilities are cleared, proceed with the import using the validated report object.
To register the virtual machine in place without moving files:
# Commit in-place import using validated compatibility report
Import-VM -CompatibilityReport $Report
To copy the virtual machine files to a new destination and generate a unique virtual machine identifier:
# Import as a new instance with a fresh unique GUID
Import-VM -CompatibilityReport $Report `
-Copy `
-GenerateNewId `
-VirtualMachinePath "C:\Hyper-V\VMs\" `
-VhdDestinationPath "C:\Hyper-V\Disks\"
Verifying the Imported Virtual Machine Operational State
Confirm that the newly registered or copied machine is present in the Hyper-V inventory and verify its attached resources:
# Inspect imported virtual machine status
Get-VM -Name "SQLServer-01" | Format-List Name, State, Generation, MemoryAssigned, NetworkAdapters
# Start the virtual machine to confirm clean execution
Start-VM -Name "SQLServer-01"
By using Compare-VM to catch and resolve missing dependencies prior to execution, system administrators eliminate migration downtime and ensure consistent virtual machine deployment across Windows 11 workstations.