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 (13)
  1. Sebastian says:

    Hi Mohamed,

    I am trying this on our 2k8 Datacenter Core edition Hypervisor and cannot really make it to work.

    My aim is to change the name of folder where the VM is kept.


    The location of VM is k:vmcvsce-s01

    The location of xml file is  k:vmcvsce-s01virtual machines


    The location of VM is k:vmcvsce-s02

    The location of xml file is  k:vmcvsce-s02virtual machines

    Basically I follow your instruction using my data. I stop the Management Service, rename, for safe keeping, corresponding xml file in

    C:ProgramDataMicrosoftWindowsHyper-VVirtual Machines

    then I move the VM files files to new location from  k:vmcvsce-s01 to k:vmcvsce-s02. Run comand in C:ProgramDataMicrosoftWindowsHyper-VVirtual Machines

    mklink 4CDFE36D-CAA9-425A-8A55-DA8CC406481E.xml "k:VMCVSCE-S02Virtual Machines4CDFE36D-CAA9-425A-8A55-DA8CC406481E.xml"

    with result

    symbolic link created for 4CDFE36D-CAA9-425A-8A55-DA8CC406481E.xml <<===>> k:VM

    CVSCE-S02Virtual Machines4CDFE36D-CAA9-425A-8A55-DA8CC406481E.xml

    I set the access rights on newly created file (and actually on target xml file as well) using:

    cacls 4CDFE36D-CAA9-425A-8A55-DA8CC406481E.xml /E /g "Users":F

    Then I start the Hyper-V Management service again but my VM does not show up.

    If I stop the service again and use the original xml file which is pointing to old location (were files still reside – I made a copy instead of move (I also moved to be sure with no difference)) the original VM will show up on the list.

    Any ideas what is missing?

    Thank you.

  2. You can use the Export feature to copy a VM, afterwards just delete the original VM.

  3. Daniel says:

    For me it worked. It saved me a lot of time.

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

  4. foad elmi says:

    this method saved my life! thanks

  5. biotec69 says:

    bonjour un script shell qui me permet de planifier l'arret des vms  tous les dimanches matin , permettre par la  suite d'exporter les vms à un emplacement précis et a la fin permettre de restarter tous les vms

  6. I use a powershell script to create and fully configure the VMs. It is table-driven (CSV file)

    $File = Import-CSV -Path $Path

    ForEach ($Line in $File)

    {  $VMName = $Line.VMName

      $ComputerName = $Line.ComputerName

      $Generation = $Line.Generation

      $ProcessorCount = $Line.ProcessorCount

      $DynamicMemoryEnabled = $Line.DynamicMemoryEnabled

      $MinimumBytes = $Line.MinimumBytes

      $StartupBytes = $Line.StartupBytes

      $MaximumBytes = $Line.MaximumBytes

      $SwitchName = $Line.SwitchName

      $StaticMacAddress = $Line.StaticMacAddress

      $VMDiskDrive = $Line.VMDiskDrive

      $VMDiskFolder = $Line.VMDiskFolder

      $VMNewDiskFile = $Line.VMNewDiskFile

      New-VMSwitch -ComputerName $ComputerName -Name $SwitchName -SwitchType $SwitchType -ErrorAction SilentlyContinue

      New-VM -Name $Name -ComputerName $ComputerName -Generation $Generation -SwitchName $SwitchName

      Set-VMProcessor -VMName $Name -ComputerName $ComputerName -Count $ProcessorCount

      Set-VMMemory -VMName $Name -ComputerName $ComputerName -DynamicMemoryEnabled $DynamicMemoryEnabled

     -MinimumBytes $MinimumBytes -StartupBytes $StartupBytes -MaximumBytes $MaximumBytes

      Set-VMNetworkAdapter -VMName $Name -ComputerName $ComputerName -StaticMacAddress $StaticMacAddress

      Set-MyVMHardDiskDrive    -MName $Name -ComputerName $ComputerName -Generation $Generation -VMDiskDrive $VMDiskDrive                        -VMDiskFolder $VMDiskFolder -VMNewDiskFile $VMNewDiskFile -VMNetworkAdapter $SwitchName

      Start-VM -Name $Name -ComputerName $ComputerName


  7. Jeff Green says:

    The key to doing this in 2008 R2 is to disable then stop the Hyper-V Management service. If you don't, it will start itself before you can apply permissions and the command will succeed although it did not work.

  8. Zbig says:

    Hi all;

    while applying access rights to symlinks (under "CProgramDataMicrosoftWindowsHyper-VVirtualMachines"

    use the "L" switch in command:

    icacls 4CDFE36D-CAA9-425A-8A55-DA8CC406481E.xml /grant "NT VIRTUAL MACHINE4CDFE36D-CAA9-425A-8A55-DA8CC406481E":(F) /L

    the symlink itself requires rights for VM specific user to be set;

  9. IAMDASYSOP says:

    This works, but the procedure as a whole is incomplete. Here are a few extra bits to consider:

    – Apply any pending snapshots to avoid error messages.

    – Make a list of your old and new file paths and reference ID's and which server they belong to before you start.

    – You may also want/need to change the VHD file paths, as well as the snapshot and pagefile paths.

    – If the VM guest disappears from the Hyper-V console after you restart the service, don't panic! Reimport the XML file.

  10. Jacob says:

    It worked for me I also faced similar permission issue. It worked when I gave full control to "users" on the Original file

    But then reverted and given Full permission using icacls to the VM and the "Users" on the xml file it worked too.

    But thanks to this Solution now I don't have to do the time consuming thing Export and import. I Hate it !!!

  11. Jacob says:

    *given Full permission using icacls to the VM and the "Users" on the SymLink not the xml file

  12. Thorsten Albrecht says:


    In Hyper-V Server 2012R2 it’s not necessary anymore to fix the permissions on the created symlinks (when moving the VM manually instead through the management GUI). Just create the symbolic link after moving the VM – and that’s it. Perhaps this was only necessary in Hyper-V Server 2008.

  13. Wynn says:

    Windows 10 Hyper-V doesn't have an XML file.  I was unable to follow these directions at step 4.  Is the procedure different for Windows 10 Hyper-V?

Comments are closed.

Skip to main content