Freigeben über


What if you move Hyper-V files before Exporting the Machine?

Go to the “missing VM folder\virtual Machines\” and take note of the file {GUID}.xml (In this scenario is the 71DB1869-534A-4B0B-B2B8-B89170FC0EF0.xml).

Find your GUID, then copy all the below and replace 71DB1869-534A-4B0B-B2B8-B89170FC0EF0 with your GUID

Update the file locations too just to make sure everything works.

Using Mklink, create the Symbolic link under “C:\ProgramData\Microsoft\Windows\Hyper-V\Virtual Machines”

Mklink “C:\ProgramData\Microsoft\Windows\Hyper-V\Virtual Machines\71DB1869-534A-4B0B-B2B8-B89170FC0EF0.xml” “F:\VM01\Virtual Machines\71DB1869-534A-4B0B-B2B8-B89170FC0EF0.xml”

Now give access permissions to the service SID to this Symbolic link.

Icacls “C:\ProgramData\Microsoft\Windows\Hyper-V\Virtual Machines\71DB1869-534A-4B0B-B2B8-B89170FC0EF0.xml” /grant “NT VIRTUAL MACHINE\71DB1869-534A-4B0B-B2B8-B89170FC0EF0“:(F) /L

Then you need to give access permissions to the Service SID to all files in VM01

Icacls F:\VM01\ /T /grant “NT VIRTUAL MACHINE\71DB1869-534A-4B0B-B2B8-B89170FC0EF0“:(F)

[ Source:  https://blog.greypuddles.net/?p=142 ]

UPDATE: IF YOU HAVE SNAPSHOTS, THIS MAY CAUSE PROBLEMS LATER.

I hit the following errors when deleting the snapshots, after the move.

“Cannot delete snapshot: The specified network resource or device is no longer available.”

“System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.  Parameter name: dmtfDate”

LESSON LEARNED: ALWAYS EXPORT AND IMPORT YOUR VM TO MOVE PHYSICAL LOCATION

UPDATE 2: THIS STILL WORKS LIKE A CHARM IF DELETE ALL SNAPSHOTS BEFORE THE MOVE! :)