Hyper-V VMs cannot find the path after storage migration

VMs cannot find the path specified

I encountered an interesting issue today after completing a VM storage migration of approximately one hundred Hyper-V VMs.  Most of them began reporting: VMs cannot find the path

All one hundred Hyper-V VMs were highly available VMs and needed to be moved from one set of CSV LUNs to a different set of CSV LUNs.

This isn’t anything I hadn’t done a dozen times before as storage migrations are relatively straightforward.  You can initiate the storage migration via the Failover Cluster GUI or script something similar to this:

$vms = #get a list of your vms here however you wish
#loop through and move your VMs to the desired location
foreach($vm in $vms){
    Move-VMStorage $vm -DestinationStoragePath C:\ClusterStorage\Volume1\VMs

Once the migration was completed however, only four of the VMs would start with the rest indicating the following cluster error:

Cluster resource 'Virtual Machine Configuration aVMName' of type 'Virtual Machine Configuration' in clustered role 'aVMName' failed. The error code was '0x3' ('The system cannot find the path specified.').

The VMs experiencing an issue were still showing in Failover Cluster Manager but were not visible in Hyper-V Manager any longer.

Slightly worried I quickly verified that the virtual machine files were at the target destination and they were:
Hyper-V Virtual Machine Locations

The GUID folders were empty as expected as the VMs were off.  The XML files were located in the parent target directory as well:

Hyper-V Virtual Machine Locations - XML and GUID folder structureThe VMs that were running had good bin and vsv files:

Hyper-V VM bin and vsv file locations

I also verified all vhdx files had successfully migrated to their target destinations.

Perplexed, I attempted to perform an Import Virtual Machine against one of the GUID .xml files.  It worked.  The VM popped right up in Hyper-V Manager.  I couldn’t add it back as an HA VM because it already existed in the cluster.  So, I removed it from cluster, and then just made the VM HA again.  It started right up.

No explanation for what caused this perplexing issue but I had a solution – but having to re-import and make 100 VMs HA manually was not shaping up to make a fun day.

So, I decided to whip up a quick script.

I started by removing all the HA VMs from the Failover Cluster Manager.  They were all just reporting: VMs cannot find the path

I pulled all the GUIDs in from the storage locations and loaded those GUIDs into an array.

Then I:

  1. Looped through each GUID in the array – and imported it back into Hyper-V
  2. Added the VM back into the cluster
  3. Started the VM

Fix time manual: hours?

Actual fix time: 20 minutes!

#declare an array containing all the XML GUIDs
$anArray = @()
$anArray = 

#loop through each guid in the array
foreach($guid in $anArray){
    #import and register the VM again as a local VM
    $id = import-vm -path "C:\ClusterStorage\Volume2\VMs\Virtual Machines\$guid.xml"
    #return the VM to a HA VM in the cluster
    Add-ClusterVirtualMachineRole -VMName $id.name
    #star the VM back up
    Start-VM $id.name

4 Responses

  1. Corey Dockendorf says:

    Keeping this one in my back pocket for a rainy day. Great work!

  2. Christopher Cavazos says:

    Awesome job creating a solution that worked and saved hours of time!

  3. Jordan says:

    What would happen if you tried to migrate a Physical Machine that has hardware SCSI Raid5 implemented to a VM that will use IDE ? I am expecting something similar like
    this to occur where the NEW VM will be looking for the SCSI drivers/config and generate a blue screen when the new VM boots. Any positive ideas on this. I have only done the single disk to single disk and cant seem to find anyone who has done it with RAID5. Thanks

  4. Jeff Rudacille says:

    Two and one half years later and this suggestion still works, thanks! In my case I created two new VM’s and they would not start with the error mentioned above. Removing them from HA and importing them into Hyper-V and doing HA again fixed the issue.

Leave a Reply
