Cry about...
Windows Hyper-V-Server

How to move a virtual machine to another Hyper-V-Server


These notes are currently under construction. I am hoping to complete them soon. Sorry!

There are a number of ways you can move a virtual machine from one hyper-v server to another:

These are my notes from my experience migrating virtual machines between Windows 2008 server, Windows 8 and Windows 2012 Hyper-V server.


Live Migration (domain only; server only)

Live Migration is the easiest way to move virtual machines from one server to another, however it is only available if both servers are in the domain and if both servers are running the same version of Windows 2012 server. It cannot be used between Windows 2012 and Windows 8, nor (I think but yet to test) can it be used between Windows 2012 and Windows 2012 R2.

Sorry, notes to follow.

Whilst live migraton seems like a great idea, I have yet to see it work! In my experience it always fails while moving the virtual machine so I have always needed to revert to the export and import method.


Move (internal to single computer only)

By far the easiest way to move a virtual machine to another location on the same server is to use Hyper-V manager to move the virtual machine. Sadly you cannot use this to move to another server.

  1. Start Hyper-V Manager.
  2. Navigate down to the virtual machine to be moved.
  3. Right click and select "Move ..."
  4. Follow the wizard.

Unfortunately the "Move" option is only available if you are running inside a domain and on Windows 2012 or Windows 8.


Export and Import

Exporting is the process of using Hyper-V manager to create an image of the virtual machine. This image can then be imported on another server again using Hyper-V manager.

To export

  1. On the old server start Hyper-V Manager
  2. Navigate down to the virtual machine to be exported.
  3. On Windows 2008 the virtual machine must be shut down before it can be exported. There is no requirement to shut it down on Windows 2012 or Windows 8.
  4. Right click the virtual machine and select "Export..."
  5. You will then be prompted to select a folder to export to. Select a folder and then click [Export] and the export will start.

    A new folder will be created (named after the selected virtual machine) that contains all the files generated by the export. So if you are doing more than one export you can select the same folder.

    Hyper-V manager will show the progress of the export. This is shown in the list of virtual machines against the virtual machine in the "Status" column. You may have to expand the Hyper-V manager window to see the status column as it is to the far right.

Some gotchas to be aware of when you export:

  • If you export to a network share then you will probably get the error:

    An error occurred while attempting to export the virtual machine.

    Failed to copy file during export.

    General access denied error (0x80070005)

    This is because Hyper-V server runs using the local NT AUTHORITY\SYSTEM account, and the the local account on the hyper-v server does not have the necessary permissions on the network share. So if you export to a network share then you need to configure the receiving network share to grant full rights to the hyper-v COMPUTER. Do this as though you were adding permissions (using the advanced dialog) in the normal way, by when you click [Add...] which prompts "Select Users, Computers, Service Accounts or Groups", under "Select this object type" click [Object Types...] and check "Computers". You should then be able to add the name of the hyper-v server. Grant it full control - both on the share and on the folder. You should then be able to export successfully to the network share. (Whether the hyper-v computer needs full rights or just a subset is not something I have investigated.)

To import

  1. Copy the export folder (and all the files in it) to a suitable folder on the new server. Unless you later move the virtual machine (which is very easy) where you move the exported files to will be where they will be used from.
  2. Start Hyper-V Manger on the new server (or connect to the hyper-v instance using Hyper-V manager).
  3. Right click on the server and select "Import Virtual Machine..." (or select the server and the option to "Import Virtual Machine..." should be visible on the right hand side).

    This will start up the "Import Virtual Machine" dialog.

  4. The folder should be the name of the folder that contains the exported files.

    So if you exported a virtual machined called "MyVM" then all the files for that will be in a folder called "MyVM". If you then copied this locally to the folder say "C:\VirtualMachines" then the exported virtual machine's files will be in "C:\VirtualMachines\MyVM". In which case when importing it is the folder "C:\VirtualMachines" that you need to select.

    Unfortunately there are some errors you might encounter at this point:

    If you are unfortunate enough to encounter one of these errors then the above links take you to my notes for a way forward.

  5. You should be presented with a list of machines available to import - which typically will just contain the machine you want. Select it and click [Next >]
  6. You will now be asked the type of import to perform.

    This will be one of:

    o Register the virtual machine in-place (use the existing unique ID)
    If the virtual machine files are already where you want them on the disk then select this option. It will import the virtual machine where it is. This is the quickest option because it doesn't require any additional file copying.
    o Restore the virtual machine (use the existing unique ID)
    If the virtual machine files are not where you want them, then select this option. You will get the option to specify where you want the machine files to reside.
    o Copy the virtual machine (create a new unique ID)
    Select this option if your intent is to create clone or multiple clones of the virtual machine. Because it will create a new unique ID you will be able to repeat the import again to create a subsequent virtual machines if you wish. (Just be sure that you are not violating any licensing restrictions.)

    Click [Next >]

  7. Depending on the type of import you selected you may be asked to specify the location to store the virtual machine files.
  8. If the virtual switches available on the new hyper-v server are different to those on the original hyper-v server then you will probably encounter the error:

    The following configuration errors were found for virtual machine 'MyVM'.

    This simply means that it could not find the switch, and you will be asked to specify which network connection to use for this virtual machine. You can then continue.

When the import has finished you should see the virtual machine listed under Hyper-V manager and you should be able to start it.

Some gotchas to be aware of when you import:

  • The virtual machine will be expecting to use a virtual network of the same name as existed on the source hyper-v server. So if the server you import on has different network names then you will need to adjust the settings of the virtual machine to specify which virtual network to use.
  • If the virtual machine was set to use a static IP address for its network adapter then you will need to check and most probably reset the IP address. The reason for this is that if the new virtual machine has a new (or different) virtual network adapter then the virtual machine will now be using a different/new network adapter and the default settings is for it to use DHCP.
  • If the network adapter in the virtual machine uses DHCP then the IP address assigned to it will probably be different so if you are trying to connect to it across the network then you may need to do an "ipconfig /flushdns" locally in order to pick up the new IP address.


Shutdown and copy

Whilst I would recommend exporting over shutting down and copying, you can move a virtual machine to a new server by copying all of its files. It must be shutdown first to ensure that the files are in a consistent state.

  1. Shut down the virtual machine.

    You can shut it down either via Hyper-V Manager or by logging onto the virtual machine and shutting it down that way. If the virtual machine isn't a Windows virtual machine then the only way of shutting it down is probably by logging in and issuing a shutdown command.

  2. Copy both the virtual hard disk files (*.vhd or *.vhdx files) and the virtual machine configuration file (*.xml).
  3. If the hyper-v server running on the destination server is the same version of hyper-v then you should treat this as an import and try importing the copied files. See "To import" above.
  4. If the hyper-v server is a different version (or if you only have the virtual hard disk files) then your only option is to create a new virtual machine, but instead of creating a new virtual hard drive use the one (or ones) that you have copied across. You should try to keep the configuration as close as possible to the original, and this will be much easier if you still have access to the settings of the virtual machine on the export server. Failing that a reasonable guess as to the amount of RAM, number of processors and network configuration will most likely work. You will need to review the network settings - as it will have a new network card the IP address will default to DHCP which is fine unless you need it to have a static IP address.

Backup and restore

Sorry, notes pending.



About the author: is a dedicated software developer and webmaster. For his day job he develops websites and desktop applications as well as providing IT services. He moonlights as a technical author and consultant.