Sometimes maybe need to move one of our Virtual Machine from one HYPER-V host to another hardware and HYPER-V Host. I wll not explain why must be done because everyone has the own reasons to do it. But The most common reasons that need to move your Virtual Machine are to free up space, free up resource of your HYPER-V Host or to change the hardware of your HYPER-V Host.

Sometimes you might need to copy files from a Hyper-V Virtual Machine or Guest to the Hyper-V Host. PowerShell can easily help you with that. Just use the -VMName parameter with the New-PSSession cmdlet on the Hyper-V Host to create a new session to the Hyper-V VM and store it in a variable. Provide credentials for the VM if needed. There are many ways to transfer files between Hyper-v VM and Physical System. The simplest way is to Drag and Drop files in Hyper-v or Copy and Past to a VM. You can do this method with Windows 8.1, Windows 10 and Windows Server 2012 R2. How to Drag and Drop Files in Hyper-v? My computer runs Windows Server 2008 R2. It hosts a Hyper-V virtual machine running Ubuntu 12.04 as the guest OS. I want to copy text from Ubuntu and paste this text in Windows (and copy text in W. Export and import VM in Hyper-V is useful when copying virtual machines to different Hyper-V hosts and you want to keep everything intact including snapshots (checkpoints). If you’re doing it on the same Hyper-V.

Before start to explain how can move the Virtual Machine we must be careful with some consideration. These are :

  • How downtime involved in process?
  • How long the migration will be take?
  • Do we have the resources in the new HYPER-V Host for the Virtual Machine?

The reason is that we don't want to have any problem while moving the Virtual Machine and the process must be done as fast as possible with little or no downtime of Virtual Machine.

We have different ways to move a virtual machine in another HYPER-V Host that i will explain all of them in feature articles. The most possible ways to do it are:

  1. Copy VM files
  2. Live Migration
  3. Replication
  4. Backup and Restore

Copy Hyper-v Vm To New Host

I will start with the first Way that i use it sometimes because it's very easy without High Risk. The disadvantages of this ways are

Hyper
  • you must perform the process after hours because you will have downtime in both HYPER-V Hosts.
  • HYPER-V Settings of the Destination Server must be the same. For example if your Virtual Switch Name in the destination server has different name then the VM will failed to start.

Let's start!!

  • Open the HYPER-V Manager from the source server.
  • Click in the right side HYPER-V Settings.
  • Locate Virtual Hard Disks and Virtual Machines Path.
  • Click from the right side Stop Service to stop the Hyper-V Management Service.

​

  • Open the folder of Virtual Hard disks and locate the hard disk of the VM that you want to move.
  • Open the folder of Virtual Machines and locate the xml file and the SID folder which is the same name with the xml file. To identify quickly the xml file and folder go back in the Virtual Hard disks. Right click in the hard disk and select Properties. Click on Tab Security and find a alphanumeric group like 45BHR657-5T6Y-XXXX-XXX..........This is the name of the file and folder which related to the specific VM.
  • Copy the vm hard disk,xml file and SID folder in the new Location of Virtual Machibes and Virtual Hard disks in the destination HYPER-V Host.
  • In the destination Server open the Cmd with Run as Administrator.
  • Type the following commands to give the appropriate permissions. If you don't give the permissions the VM will faile to start:
    icacls <path of xml fie> /grant 'NT VIRTUAL MACHINE<Virtual Machine SID> ':F
    For example: icacls 'C:Programm DataMicrsoftWindowsHyper-VVirtual Machines' /grant 'NT VIRTUAL MACHINE48C5CA29-71A8-4096-9222-C1121C7D7677':F
    icacls <path of virtual hard disk> /grant 'NT VIRTUAL MACHINEVirtual Machine SID ':F
    For example: icacls 'C:UsersPublicDocumentsHyper-VVirtual hard diskswindows8.1.vhdx' /grant 'NT VIRTUAL MACHINE48C5CA29-71A8-4096-9222-C1121C7D7677':F

​

  • Open the HYPER-V Manager in the Destination Server.
  • From the right side clcik Stop Service and Start Service again.
  • Now yo can see the Virtual Machine that copy in this Server.
  • Start the Virtua Machine without problem. If face any problem while start the VM verify that the appropriate permissions have give it in vm hard disk and SID folder.
  • Also one of the problem that face when start the VM was with Virtual Switch Name. If the Virtual Switch Name is different in the destination you must change it to be the same name as the source server.

This is the older method of all and diffcult. It's an appropriate for small VM'S because you don't need lot of time to complete the transfer in the new destination HYPER-V Host.

It will be my pleasure if you have your own recommendations or questions or different opinion to be share in our commented system. You can help others or help yourself.

Free Tools for everyone

Other Blogs

Clone a VM in hyper v, which can make a copy of an existing virtual machine without install again. It is a great useful feature; however, Hyper-V doesn’t provide any straightforward options for us to create. Accordingly, let’s see two workarounds below of how to clone a virtual machine in Hyper-V Windows 10 with ease.

Here are two options you can try below:

Preparation

Before cloning a virtual machine in Hyper-V, we need to run the system prepare tool (Also named Sysprep.exe in the host machine) if the virtual machine joins to Active Directory (AD) domain on the same network. It would wipe the unique security identifier (SID) and prevent two computers from having the same IP or name. Run system preparation tool won’t cost too much time or cause any damage of your Windows files.

What Is Hyper-v

Step 1: Navigate to C:WindowsSystem32Sysprep. Double-click on the Sysprep.exe file to run the entire Windows setup process.

Step 2: Select Enter System Out-of-Box Experience (OOBE) from the drop-down, check the box of Generalize and choose Shutdown as the image below. Tap OK to begin.

Option 1: How to Clone a Virtual Machine via Export and Import

Step 1: In Hyper-V Manager windows, select a virtual machine and click on Export on the right panel.

Step 2: Specify a location to save the files and then tap on Export.

Step 3: Click on Import Virtual Machine.

Step 4: Click on Next and locate the folder that you export above.

Step 5: Select a virtual machine and choose import type.

Step 6: Choose a new or existing folder for virtual machine.

Step 7: Choose a folder to the imported virtual hard disk.

Step 8: Tap on Finish to complete the import wizard.

Copy Hyper V Vm

Hyper-v Manager Download Windows 10

Option 2: How to Clone a Virtual Machine by Copying the Virtual Hard Disk

Step 1: Right-click on the virtual machine that you want to clone and select Settings.

Step 2: Click on Hard Drive in the left panel. Then you can see where the location of the virtual hard disk is.

Step 3: Locate to the folder of the virtual hard disk and right-click to copy it. Rename the cloned virtual hard disk.

Copy Hyper-v Vm With Snapshots

Step 4: Click on Action > New > Virtual Machine from the menu bar.

Copy Hyper V Vmware

Step 5: Follow the New Virtual Machine Wizard to create a new one. In the Connect Virtual Hard Disk, select Use an existing virtual hard disk. Click on Browse to locate to the cloned virtual hard disk. Tap on Next to complete the wizard.