Solved: How to move a Hyper-V virtual machine without Exporting it first

So you have created many virtual machines in Hyper-V manager and suddenly you want to move one of them in a new HDD or just rename the folder holding it, you will find that this is not a trivial task! Hyper-V management service holds an open handle to the XML file describing the virtual machine settings so you cannot change it in any way. The out of the box method is to export the VM to another folder and then re-import it from that folder to a new one, while this works great sometimes it is not applicable specially if the VM size is huge and you have no disk space to replicate it (since the export would replicate the VHD of the VM) so how to do it, well here you go follow these steps:

1.       Stop or shut down your VM (you cannot save its state!)

2.       Stop the Hyper-V management service from the management console

3.       Once it is stopped browse to the folder “C:\ProgramData\Microsoft\Windows\Hyper-V\Virtual Machines”

4.       You will find a symbolic link file to the XML settings file of the VM with the same name just rename it to any other name:

5.       Then move the VM to the new folder or rename the folder (do your thing).

6.       Once the VM is moved then open a new command prompt as an administrator and then type the command

C:\ProgramData\Microsoft\Windows\Hyper-V\Virtual Machines>mklink 0B142A56-4B3F-4AE5-88E5-AC21B33CE290.xml "<VM new path>\0B142A56-4B3F-4AE5-88E5-AC21B33CE290.xml"

7.       Then right click on the newly created symbolic link file and then click security tab and edit. You need to give the local users full control over this created file as shown below:

8.       Now go back to the computer management and start the service again

9.       Now you will find your VM moved and ready to start.

The only limitation here is that you lose any saved states (I still do not know why but I am planning to look it over).

Comments (26)

  1. Anonymous says:

    What a pain in the rear… Thanks MS… well thought out. You build in a Wizard to move to different HOSTS yet it is exceedingly tiresome to simply move to another folder on the same machine 🙁

  2. Anonymous says:

    update: i was getting errors trying to star the VMs after having moved the VM/VHD to another volume. The creation of the Symbolic links as stated above worked for me to import the VM into the Hyer-V console, however, when attempting to start the VM, i
    would get access denied or "General" access errors. When comparing NTFS perms on the original symbolic links with the symbolic links i created i noticed that the original links had the VM GUID permissioned with Full control. So i did a bit of digging around
    and it turns out that the VM’s guid needs to be permissions on the new symbolic link AND the moved VHD, apparently you can only do this via icacls. such as, for the symbolic links (assuming working directory is "%programdata%microsoftwindowshyper-vvirtual
    machines"): icacls .xml /grant "NT VIRTUAL MACHINE":F and for the VHD (assuming workding directory is the folder containing the VHD): icacls .vhd /grant "NT VIRTUAL MACHINE":F here’s a reference related to perms on the VHD (
    Christmas came early this year… good luck (4LI6HI3RI)

  3. Anonymous says:

    tremendous… simply tremendous. I had come very close to this. Excpect i used explorer to create the link and didn’t permission users. i’m saving this post as a PDF for later. There will be lots of occasions.

  4. One comment regarding the snapshots, If there are some snapshots you must make the same changes. You must rebuild the symbolic links from C:ProgramDataMicrosoftWindowsHyper-VSnapshots.

  5. Anonymous says:

    Thank you Mohamed, this just saved me a lot of heartache.

  6. In this case yes you need to change the mslink as this would be a move of the VM from a location to another.

  7. Great post. Thanks for sharing.

  8. Hi Pragnesh,
    The method I described in this post is obsolete now as we have a solution out of the box for this problem using the register option that was provided as part of Windows 8 and Windows server 2012 as described here
    So unless you are using an old Hyper-V server use the out of the box option. If you are indeed using a Windows 2008 R2 (or earlier) then to rollback you still need the mlink.

  9. Anonymous says:

    Mohamed, did you ever find out how to preserve the Saved States ? or how you can get them back after your procedure above ?

  10. If you want to rename the VM you can just do this from the administration console. Right click and then rename. and in this case you should not do anything to the files or folders.

  11. Great article but if I stop the service the virtual machine will be unavailable. I do not see the Camaguey not to export

  12. Big Mook says:

    Awesome. Worked like a champ. You are the man!

  13. sally says:

    If i just want to rename the VM, can I just stop the Hyper-V services and rename the folder and files? In this case do I need to do anything with the .xml file?  Thanks.

  14. sally says:

    thanks for your response. We need to change all of our VM's and server's names and would like to the folders and files have the same new names for future management. Do I need to mslink the .xml file if I just rename the folders and vhd file. Thanks.

  15. sally says:

    Mohamed,  Thanks for your information.  This is very helpful and I have successfully renamed my test VM. This is better than the import and export method.

  16. Demoxx says:

    Use Import virtual machine, you dont have to export it. IF you already have moved the VHDs and xmls 1) Rename files in C:ProgramDataMicrosoftWindowsHyper-VVirtual Machines 2) Import virtual machine, point to new location where files already are etc.
    Choose option "Register" (not restore or copy) Thats it. (unless I missed what the real problem was)

  17. Pragnesh says:


    If the move is not successful then can i revert it back to the original location and start the VM?
    or we need to do mklink again for the original location.

  18. omer yetim says:

    Thanks. Perfect sharing

  19. Jim Barr says:

    The key is really in understanding the symbolic link concept.

    Thanks for excellent information. Worked like a charm.

  20. thehinac says:

    What about when in a cluster envir. I’m guessing move VM’s all but the one you’re working on and make sure the storage is on the clustered node you’re working with?

  21. Rupert S says:

    If you simply need to move the drive to free up space as I did recently then it’s simple.
    Stop the VM. Open the folder holding the VHD. Copy the VHD/VMC/VMCBackup/VSV and move them to the new location. Go back to the Hyper V console, open the settings for the VM and change the location of the hard drive(s)
    Restart the machine.

  22. Marcus P. says:

    Hello geeks.
    Do anyone know how to rearm a Hyper-V VM offline with the use of xml files? Thanks in advance.
    Kind regards.

  23. Marcus P says:

    Hello geeks.
    Do anyone know how to rearm a Hyper-V VM offline with the use of xml files? Thanks in advance.
    Kind regards.

  24. Mae says:

    Hi Expert,

    The physical disk (E:) where my hyper-v resides is now out of space, because of the software I’m installing inside the hyper-v (the disk in hyper-v has available space). What should I do to transfer the snapshots of my hyper-v to another physical drive (D:).
    I tried to copy and paste the files (except for the latest snapshot which I will use) created during the snapshots but upon starting the hyper-v, it giving me error that it cannot see the avhd even it is available in the drive E:

  25. Derrick says:

    When I try and run this mlink command I get an error that this is not a recognized command. I am typing C:ProgramDataMicrosoftWindowsHyper-VVirtual Machines >mklink 5CDB0134-C44E-4956-A9FE-D92BC99685A8.xml "U:EMAIL2K10Virtual Machines>5CDB0134-C44E-4956-A9FE-D92BC99685A8.xml"

  26. lucy says:

    Great post from your hands again. I loved the complete article.
    By the way nice writing style you have. I never felt like boring while reading this article.

    I will come back & read all your posts soon. Regards, Lucy.