none
[Hyper-V 2016] Register VM fails with error "Virtual Hard Disk file not found" RRS feed

  • Question

  • When we tried to register vmcx file, which was copied from different FoC cluster, on a Hyper-V server, it is failing saying “Virtual Hard Disk file not found”. In this case, the exact vhdx path is present on the Hyper-V server, same as that of present in vmcx file. Then we tried to “realize” the planned VM that I get after importing vmcx in memory, which works, and I can see the VM registered successfully on server so also it can be started. 

     

    The vhdx file path is same (as that of from where it was copied) & exists on this system, surprisingly “Compare-VM” fails but “RealizePlannedSystem” works which registers VM. I want to know, what is wrong here? Am I missing something obvious?

                

     

    $new_file =   "C:\<VMID>.vmcx"

     

     

    Import-VM -Path $new_file -copy

     

    Import-VM : Unable to import virtual machine due to configuration errors.  Please use Compare-VM to repair the virtual machine.

    At line:1 char:1

    + Import-VM -Path $new_file -copy

    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        + CategoryInfo          : InvalidOperation: (:) [Import-VM], VirtualizationException

        + FullyQualifiedErrorId : OperationFailed,Microsoft.HyperV.PowerShell.Commands.ImportVM

     

    1.  

    $compareVMOutput = compare-VM -Path $new_file -copy

    $compareVMOutput.Incompatibilities | fl

     

     

    Message   : Virtual Hard Disk file not found.

    MessageId : 40010

    Source    : HardDiskDrive (Name = 'Hard Drive on IDE controller number 0 at location 0', VMName = <VM Name>') [Id = 'Microsoft:<VMID>\<CONTROLLER ID>\0\0\D',

                VMId = ‘<VMID in small case>']

     

     

    $VSMS = Get-WmiObject -Namespace root\virtualization\v2 -Class Msvm_VirtualSystemManagementService

     

    $importResult = $VSMS.ImportSystemDefinition($new_file, $null, $false)

     

    ProcessResult $importResult "VMCX loaded into memory." `

                                "Failed to load VMCX into memory."

    $plannedVM = [WMI]$importResult.ImportedSystem

     

    $realizeResult = $VSMS.RealizePlannedSystem($plannedVM)

    ProcessResult $realizeResult "Registered VM successfully." `

                                "Failed to register VM."

     

    VMCX loaded into memory.

    0 % complete

    Registered VM successfully.

    Wednesday, November 15, 2017 1:30 PM

All replies