Importing Hyper-V VM error #40010 Virtual Hard Disk file not found.

Doria 1,246 Reputation points
2021-08-17T13:35:30.477+00:00

Hi everyone!

How can I resolve the error below? May someone explain to me the error? I don't get it. The path exists!

PS C:\export> Import-VM -Path 'C:\export\Rancid\Virtual Machines\05262CA9-D444-44FE-ADF8-D364C6E0A1CA.vmcx' -Copy -GenerateNewId
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 'C:\export\Rancid\Virtual Machines\05262CA9-D444-44FE ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Import-VM], VirtualizationException
    + FullyQualifiedErrorId : OperationFailed,Microsoft.HyperV.PowerShell.Commands.ImportVM

PS C:\export> $report = Compare-VM -Path 'C:\export\Rancid\Virtual Machines\05262CA9-D444-44FE-ADF8-D364C6E0A1CA.vmcx'
PS C:\export> $report.Incompatibilities[0].Source | fl


Path                          : C:\VMs\Rancid.vhdx
DiskNumber                    :
MaximumIOPS                   : 0
MinimumIOPS                   : 0
QoSPolicyID                   : 00000000-0000-0000-0000-000000000000
SupportPersistentReservations : False
WriteHardeningMethod          : Default
ControllerLocation            : 0
ControllerNumber              : 0
ControllerType                : IDE
Name                          : Hard Drive on IDE controller number 0 at location 0
PoolName                      : Primordial
Id                            : Microsoft:05262CA9-D444-44FE-ADF8-D364C6E0A1CA\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\0\0
                                \D
VMId                          : 05262ca9-d444-44fe-adf8-d364c6e0a1ca
VMName                        : Rancid
VMSnapshotId                  : 00000000-0000-0000-0000-000000000000
VMSnapshotName                :
CimSession                    : CimSession: .
ComputerName                  : ERO-SRV-HOST02
IsDeleted                     : False
VMCheckpointId                : 00000000-0000-0000-0000-000000000000
VMCheckpointName              :


PS C:\export> $report.Incompatibilities | Format-Table -AutoSize

Message                           MessageId Source
-------                           --------- ------
Virtual Hard Disk file not found.     40010 HardDiskDrive (Name = 'Hard Drive on IDE controller number 0 at location...


PS C:\export>
Windows for business | Windows Client for IT Pros | Storage high availability | Virtualization and Hyper-V
Windows for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

Accepted answer
  1. Doria 1,246 Reputation points
    2021-08-17T20:51:49.85+00:00

    I don't understand. I exported the VM to the C:\export folder and at the time of import it fetches the VM HDD from the C:\VMs folder? What do you mean?!! The C:\VMs folder is set to the default folder where I position the new VMs created....

    Set-VMHost -VirtualMachinePath 'C:\VMs'
    Set-VMHost -VirtualHardDiskPath 'C:\VMs'
    

2 additional answers

Sort by: Most helpful
  1. Michael Taylor 60,161 Reputation points
    2021-08-17T13:59:19.453+00:00

    Based upon the error it cannot find the HDD file for the VM. Hyper-V, for whatever reason, allows you to store HDD images completely separate from the VM definition itself. Hence within the VM configuration file is a reference to the HDD that is located in a potentially completely different directory.

    Open the VM configuration file and find the HDD reference. It contains the full path. If you're moving VMs then you need to adjust this value so it works in the new environment. In theory you could use a relative path but because Hyper-V doesn't assume anything about the path relationships I don't know if it'll like it or not.

    0 comments No comments

  2. Doria 1,246 Reputation points
    2021-08-17T14:38:07.42+00:00

    but the file is there?!! What file can I edit? .vmcx?

    123969-image.png


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.