VMFS Recovery™
Recover data from damaged or formatted VMFS disks or VMDK files
Recover data from damaged or formatted VMFS disks or VMDK files
Last updated: Mar 27, 2024

How to Clone Hyper-V VM

One of the main advantages of virtualization is the swift scalability – you can deploy multiple new VMs in a matter of minutes. This is possible by cloning the files and configurations of a particular VM to form a template for creating new ones. Virtual machine cloning is much easier in VMware environments, but in Microsoft’s Hyper-V environments, it’s a bit intricate.

This article explains how to clone virtual machines in Hyper-V environments and why you should do that. Well, just a tip, you can clone a Hyper-V VM directly from the Windows Admin Center, but making the cloned VM a template for creating new ones is where requires a little bit of technicality.

What is a VM Clone?

As the name implies, a VM clone is a “cloned” version of an existing virtual machine. The purpose of cloning a virtual is typically to replicate the VM on another virtualized environment or host. VM clones carry the same configurations and data as the parent VM; however, even at that, you may still need to make further adjustments to the settings when you import it to a new host. You can clone a VM in any virtualized environment.

Hyper-V VM Clones – What Are They?

Basically, this refers to cloning a virtual machine existing within a Hyper-V environment. Hyper-V is one of the most used server virtualization platforms, and it is provided by Microsoft. You can launch Hyper-V on Windows 10, Windows Server, and other Windows OS versions. Back to the VM clone feature, when you clone a VM running on Hyper-V, you will have a replica of the VM you just cloned.

When a VM is cloned, the replica version will also have the same security identifiers and configuration settings. Interestingly, you can customize VM cloning in many ways, and the clone file can serve as a backup. For VMs in Hyper-V environments, using the “Sysprep” command first, before cloning the machine is important in many ways, but it is not compulsory. This is because Hyper-V will automatically create a new MAC address for the cloned virtual machine since you cannot have two VMs using the same MAC address on a network.

Why You Need to Clone a VM in Hyper-V?

If you already have one active VM in a Hyper-V environment, you don’t necessarily need to launch another VM from scratch – the repeat processes could be daunting, hence, cloning is the best approach. Hereunder are some reasons for cloning Hyper-V VMs.

  • When there is a need to create an exact replica of a running VM for product testing, guest OS, or any other app testing.
  • Cloned VMs include applications and configuration settings from the parent VM. So, when you don’t want to create multiple similar VMs and configure them individually, you can use clones to save time.
  • Clones can serve as a backup copy of the parent copy; if the parent VM gets tampered with, or fails due to system/host errors, the clone copy can be imported to restore its original configurations, apps, and data.
  • You need to deploy a VM on an isolated environment for specific tasks or projects; a cloned VM can serve as a “template” you can build your new VM.
  • Cloning Hyper-V helps in scalability; the cloned VM can be used to create multiple new VMs in a matter of minutes.

Tip: learn how to convert VMware to Hyper-V!

How to Directly Clone VM in Hyper-V with Windows Admin Center?

You can clone a Hyper-V virtual machine directly from the Windows Admin Center, and this follows a swift procedure. Windows Admin Center is web-based, which means you can access it from web browsers and manage your Windows server easily.

  • On the Admin Center home screen, go to Tools 🡺 Virtual Machines 🡺 select the Hyper-V VM 🡺and click on “Manage.”
  • Click on “Clone” and set a unique name for the cloned VM – choose a directory to save the cloned VM.
  • Complete the action.

How to Clone VM in Hyper-V via Export and Import (Built-in)

You can clone the Hyper-V virtual machine via the Hyper-V manager platform; this is actually using the export feature to save the VM’s configurations.

  • Open Hyper-V Manager, look out for the VM you want to clone – under Virtual Machines, right-click on it and select “Export.”
  • Choose the location you want to export the VM to, select a folder you can easily access, and then click on “Export.”

Alternatively, you can use the Export-VM cmdlet to clone a VM in Hyper-V via PowerShell, the command is: Export-VM -Name \ -Path \

Once exported, the VM has been cloned, to deploy it on another host, you have to “import” it to that Hyper-V host. To import the VM to another Hyper-V host, the steps are explained below:

  • On Hyper-V Manager, select the Hyper-V host, right-click on it, and select “Import.”
  • Browse the folder you saved the exported VM file and select it.
  • In the Choose Import Type wizard, select the “Copy the virtual machine” option.
  • Choose a new directory where the VM will be copied to, then review the details and complete the action.

Alternatively, you can manually copy VHDs, but doing so will require you to manually change the hostnames, IP address, and SID (system identifier). Also, VM backup solutions be used for cloning virtual machines; this literally means backing up the VM to re-import the backup as a clone.

Learn more about Hyper-V replication here!

Clone VM in Hyper-V via Backup and Restore (Easier)

Another way to clone a virtual machine is to use a backup solution. These backup solutions capture every detail of an existing VM and save them as a single backup file so you can restore it to another host or the same host if the primary VM runs into a problem.

There are many virtual machine backup programs out there, you have to choose the one that fits your budget. Interestingly, these apps come with additional features you may find handy for other virtual machine management purposes. It is safe and reliable to use Hyper-V backup programs.

How to Clone VM in Hyper-V with PowerShell?

Most system admins prefer using PowerShell for VM management and advanced actions. Yes, you can clone a Hyper-V virtual machine using PowerShell commands. However, just as you may already know, you have to be careful with the commands and enter the “paths” correctly. Hereunder are the commands:

  • To export the Hyper-V VM: Export-VM -Name \ -Path \
    • Remember to replace the “placeholders” with the actual VM name and paths
  • To import the VM to another Hyper-V host: You have to choose an Import Type, then run these commands:
    • Register the VM: Import-VM -Path “C:\\2B91FEB3-F1E0-4FFF-B8BE-29CED892A95A.vmcx”
    • Restore: Import-VM -Path “C:\\2B91FEB3-F1E0-4FFF-B8BE-29CED892A95A.vmcx” -Copy -VhdDestinationPath “D:\Virtual Machines\WIN10DOC” -VirtualMachinePath “D:\Virtual Machines\WIN10DOC”

Import as a copy: Import-VM -Path 'C:\\2B91FEB3-F1E0-4FFF-B8BE-29CED892A95A.vmcx' -Copy –GenerateNewId

What to do in case of Hyper-V replication failover?

What Is Hyper-V VM Template and How Can It Be Used?

Put simply, a Hyper-V VM Template is a “cloned VM image file,” which now acts as a base template for creating multiple VMs with the same properties and configurations as the primary VM that got cloned.

The essence of having a VM template is to save more time when creating subsequent VMs. Using a VM template, you don’t have to configure new VMs from scratch, you just import the cloned VM and everything is already configured, including the virtual disks; all you need to do is to set a unique name for the VM.

How to Clone a Hyper-V Virtual Machine Using VM Templates?

The procedure is the same as what is explained above. First, you need to create a new virtual machine and configure it as you wish. Once you’re done with the configuration, you now clone the VM, the cloned copy will then serve as a “VM template” for creating subsequent virtual machines.

  • Step One: Create and host a new virtual machine on your Hyper-V environment.
  • Step Two: Install a guest OS, patches, and any third-party application you want to run on the VM
  • Step Three: Clone the VM from the Admin Center or using CLI commands. (Note: before you clone this VM, if you have any Checkpoints on the VM, delete them.)
  • Step Four: If you’re using Hyper-V Manager, under Virtual Machines, right-click on the just-created VM and choose “Export.” Follow the prompts and save the export file to a particular folder.
  • Step Five: The exported file is the “cloned” version of your VM and it will serve as the VM template for any other new VM you want to deploy. To use this template, go to the Hyper-V host you want to create a VM on, right-click on the hostname, select “Import…” then import your VM template from the folder you saved earlier.

Step Six: In the Choose Import Type wizard, select the “Copy the virtual machine” option and identify a new directory for the cloned VM to be copied to. That’s all, the new VM will have the same configurations and apps as the first one you created.

How to Protect Your Data?

Backing up your VMs is very important, especially in an enterprise environment. VM backups can also act as VM templates for subsequent virtual machines. A professional VM backup solution is a priceless tool for data-centric workspaces.

How to Restore Hyper-V VM with DiskInternals?

You can recover your Hyper-V VM’s files using the DiskInternals VMFS Recovery. DiskInternals VMFS Recovery is a professional software capable of reading multiple file systems and VHDs. The software is compatible with all Windows OS versions, including Server editions; it comes with an intuitive interface, as well as a Recovery Wizard to guide the users through. Here’s a guide to recover your Hyper-V VM using DiskInternals.

Guide

  • Install and launch DiskInternals VMFS Recovery on a Windows PC
  • Connect the physical hard drive that contains the VHD that stores your Hyper-V VM data
  • Select the hard drive following DiskInternals VMFS Recovery’s wizard and choose a recovery mode – preferably, Full Recovery.
  • Launch the scan and wait for it to complete – this may take some time if you choose Full Recovery.
  • Once the scan is complete, the deleted VM files will appear with a red asterisk. To recover them, you need the premium version of DiskInternals VMFS Recovery.

Conclusion

Cloning a VM in Hyper-V is simple and can be done in many ways. VM clones make replicating virtual machines much easier as they could serve as unique templates for different types of VMs. Also, DiskInternals VMFS Recovery can be used to recover lost VM data files for free, and it’s quite easy to use.

FAQ

  • How do I replicate a Hyper-V virtual machine?

    To replicate a virtual machine, perform these steps for each VM you wish to duplicate: Open Hyper-V Manager and in the Details pane, click on the virtual machine you're targeting. Right-click this VM and choose "Enable Replication" to launch the Enable Replication wizard. Click "Next" on the "Before you Begin" page.

    To clone an existing virtual machine, follow this procedure:

    • From the Virtual Machine Library, choose the virtual machine you want to clone.
    • Click on "Snapshots."
    • Right-click on the snapshot you select and choose either "Create Full Clone" or "Create Linked Clone," depending on the clone type you prefer.
  • How do I copy and paste to a virtual machine in Hyper-V?

    To copy the text, right-click and choose "Copy," or use the shortcut Ctrl+C. Then, within the VM, click on the location where you wish to insert the text and press Ctrl+V to paste it. Please note, there might be a brief pause before the text appears after pressing Ctrl+V.

  • How do I migrate a virtual machine from Hyper-V to Hyper-V?

    Open Hyper-V Manager on the destination host, click the server name, and choose "Import Virtual Machine." Navigate to and select the primary parent folder of the exported machine you've copied. After selecting it, hit the "Import" button to initiate the import process.

  • How long does it take to clone a Hyper-V virtual machine?

    The time it takes to clone a Hyper-V virtual machine depends on various aspects, such as the size of the VM, the performance capabilities of the host machine, and the cloning technique chosen.

Related articles

FREE DOWNLOADVer 4.20, WinBUY NOWFrom $699

Please rate this article.