How-To: Manipulate Hyper-V VM Symbolic Links (or How to Unregister and Register Virtual Machines without Deleting Them)

How-To: Manipulate Hyper-V VM Symbolic Links (or How to Unregister and Register Virtual Machines without Deleting Them)

Hyper-V operates using a list of symbolic links in a specific directory:

·         C:\ProgramData\Microsoft\Windows\Hyper-V\Virtual Machines

Each of these are links to the actual VM configuration files in their own respective subdirectories – whether stored locally or on shared storage, the link doesn’t change in its nature.

All you need to know in order to control which VMs are displayed in Hyper-V Manager follows:

1.   First you need to identify the GUID of the specific VM.  Look in the directory location for the VM you wish to manipulate and note the name of the .XML file in the Virtual Machines subdirectory.


     Our example will use the LitwareSpeech VM, located at D:\VMs\LitwareSpeech.  In the “D:\VMs\LitwareSpeech\Virtual Machines” path is the configuration file for this VM, named “D546B942-76AF-4C3B-97C6-9EE74828BC91.XML”

2.   To delete the reference to this VM in Hyper-V Manager, browse to “C:\ProgramData\Microsoft\Windows\Hyper-V\Virtual Machines\” and locate the symbolic link that is named after the VM GUID.  Deleting this link only deletes the reference to the VM in Hyper-V Manager – it does not delete the actual configuration of the VM or the VHD.



The path “C:\ProgramData” is a hidden directory path.  See “Viewing Hidden Folders” section later to complete these steps, if necessary.


3.   To later restore the reference to the VM, browse to the location, “C:\ProgramData\Microsoft\Windows\Hyper-V” and Shift-RightClick on the Virtual Machines directory.  Select Open Command Window Here.

4.   Using the VM GUID that you determined above in Step 1, run the following command:

mklink <GUID>.XML <VMConfigPath.XML> or in our example

mklink D546B942-76AF-4C3B-97C6-9EE74828BC91.xml “D:\VMs\LitwareSpeech\Virtual Machines\D546B942-76AF-4C3B-97C6-9EE74828BC91.xml”

This restores the reference to your VM in Hyper-V Manager.


The catch to this operation that I’ve learned is that when you create a VM, Hyper-V creates a security entry (ACE) on this symbolic link for the SID of the worker process for the VM.  Unfortunately, this ACE isn’t re-created when you recreate the symbolic link using mklink as detailed above.

If you try to start your re-registered VM at this point, you’re likely to receive this error message:


To address this requirement, follow these steps:

1.   Again, locate and note the GUID of the VM.

2.   Using this GUID, run the following command:

icacls “C:\ProgramData\Microsoft\Windows\Hyper-V\Virtual Machines\<GUID>.xml” /grant “NT VIRTUAL MACHINE\<GUID>“:(F) /L


Or in our example from above:

icacls “C:\ProgramData\Microsoft\Windows\Hyper-V\Virtual Machines\D546B942-76AF-4C3B-97C6-9EE74828BC91.xml” /grant “NT VIRTUAL MACHINE\D546B942-76AF-4C3B-97C6-9EE74828BC91”:(F) /L

3.   This process regenerates the necessary ACE on the symbolic link using the Service SID of the VM, rather than on the configuration file itself, replicating the initial state of the symbolic link.

4.    Once this command has been run successfully, you should be able to start your VM without further issues.



Viewing Hidden Folders

1.   Open Windows Explorer.  Select Tools, Folder Options…


2.   Select the View Tab and choose the option to “Show hidden files and folders”

3.   Click OK.



9 thoughts on “How-To: Manipulate Hyper-V VM Symbolic Links (or How to Unregister and Register Virtual Machines without Deleting Them)”

  1. Ryan, does this method work in Windows 2008 R2? I can get everything running but I must stop and start the hyper-v service before hyper-v will pick up the VM.

  2. Currently you also need to restart the Hyper-V Management Service to make the relocated VM reappear in the management console.

    net stop “HYPER-V Virtual Machine Management”
    net start “HYPER-V Virtual Machine Management”

  3. I followed your steps, but the VM didn’t reappear after I created the symbolic link. I tried to restart Hyper-V service (even restared host) but the VM is still not there.

    I read it somewhere that antivirus programs can cause this problem, so I stopped my antivirus from scanning Hyper-V locations. But still the same.

    I’m running Windows Server 2008 R2. Any advice would be really appreaciated.

  4. I get an incorrect syntax error when using the command

    mklink D546B942-76AF-4C3B-97C6-9EE74828BC91.xml “D:\VMs\LitwareSpeech\Virtual Machines\D546B942-76AF-4C3B-97C6-9EE74828BC91.xml”

    unless I put quotes round the link name e.g.

    mklink “D546B942-76AF-4C3B-97C6-9EE74828BC91.xml” “D:\VMs\LitwareSpeech\Virtual Machines\D546B942-76AF-4C3B-97C6-9EE74828BC91.xml”

Leave a Reply

Your email address will not be published. Required fields are marked *