Complete guide to importing and exporting virtual machines in Hyper-V

Last update: 30/04/2025
Author Isaac
  • Export and import in Hyper-V allows you to migrate, backup and clone Virtual machines efficiently.
  • There are several import methods depending on the requirements of each scenario, differing in the management of unique identifiers and file location.
  • Migration between hypervisors requires converting disks to the appropriate compatible format, avoiding errors due to incompatibility of hardware virtual or duplicate SIDs.
  • For advanced protection and automation, it is advisable to complement these basic processes with solutions of backup specialized or custom scripts.

hyper-v

Virtualization has become a fundamental tool for system administration and efficient IT infrastructure management. One of the most widely used hypervisors in corporate and home environments is Hyper-V, the Microsoft solution. The ability to import and export virtual machines in Hyper-V Not only does it save time provisioning new servers, but it also facilitates migration, backup, and disaster recovery.

In this article you will find a Complete and detailed explanation of the process of exporting and importing virtual machines in Hyper-V, including practical tips, version differences, import types, how to proceed in migration scenarios between different hypervisors, and solutions to common errors. All presented in a clear, organized, and easy-to-understand manner, both for experienced administrators and those new to virtualization.

Why export and import virtual machines in Hyper-V?

The management of virtual machines (VMs) by export and import It is key in multiple scenarios:

  • Migration between hosts: Allows you to move VMs between different servers, whether for maintenance, load balancing, or hardware upgrades.
  • Backup and recovery: Serves as a manual or ad-hoc backup method, storing a working copy of the VM that can be restored in the event of failure or corruption.
  • Cloning and rapid deployment: Facilitates the creation of templates or the cloning of already configured systems to save time on repetitive tasks.
  • Testing and development: Allows you to replicate production environments in test environments, avoiding risks to critical systems.

Exporting a virtual machine involves taking all of its associated files—virtual hard disks, configurations, and checkpoints—and gathering them into a secure location, while importing a virtual machine involves registering those files on a new Hyper-V host so they work just like they did in their original environment.

Basic concepts and previous considerations

Before delving into the specific steps, it is essential to understand some key concepts and requirements in Hyper-V:

  • Versions: The export/import functions have been evolving. As of Windows Server 2012 allows you to export running VMs and supports direct export to network folders, making the process much easier. Previous versions required VMs to be shut down for export.
  • Export on demand: Export is not an automatic or incremental process, but is performed manually each time a full copy of the VM is needed.
  • disk formats: Hyper-V uses virtual hard disks in VHD or VHDX format, the latter supporting larger sizes and being the most recommended for new VMs.
  • Hypervisor compatibility: OVF/OVA formats, widely used in VMWare o VirtualBox, are not directly supported by Hyper-V. If you need to migrate between different virtualization solutions, you'll need to convert the disks to the appropriate format.
  How to configure IP for network gaming in Windows

The process of exporting a virtual machine in Hyper-V

Exporting a virtual machine in Hyper-V is a simple procedure, but it requires knowing a few details to obtain an optimal result and avoid subsequent frustrations. There are two main ways to perform this process: through the Hyper-V Manager graphical interface and using PowerShell.

Export from Hyper-V Manager (graphical interface)

  1. Access Hyper-V Manager from the server or host computer.
  2. Select the VM to export: Right-click on the desired virtual machine.
  3. Choose the “Export” option: A window will open to select the destination.
  4. Specifies the export location: A local directory with sufficient space is recommended, as all files, including disks, configurations, and checkpoints, will be exported.
  5. Monitor progressThe process may take a while depending on the size of the VM and its virtual hard disk. Once complete, a folder structure with all the VM information will appear in the specified location.

Important note: Since Windows Server 2012, it is possible to export virtual machines without stopping them, although in previous versions it is essential that they are previously shut down.

Export a VM using PowerShell

PowerShell provides an automated and repeatable way to perform exports, ideal for backup scripts or multi-VM migrations.

The basic command is:

Export-VM -Name "NombreDeLaVM" -Path "C:\Directorio\De\Exportacion"

To export all VMs on the host simultaneously:

Get-VM | Export-VM -Path "C:\ExportacionesGlobales"

Remember to run PowerShell as an administrator to avoid permission errors.

Furthermore, you can schedule these scripts to create periodic automatic backups using the Windows Task Scheduler.

What export includes and important considerations

The export process gathers in the destination folder:

  • Configuration files of the virtual machine.
  • virtual hard drives (VHD or VHDX).
  • Checkpoints or existing snapshots.

This copy is independent and can be stored as a backup, moved to another host, used for testing, or served as a template for new deployments.

However, it is important to note that Hyper-V export is not an advanced backup system: It doesn't have deduplication, compression, or encryption like professional solutions, so files occupy the same space as in production. It's also not incremental: each export is a full copy.

How to import a virtual machine into Hyper-V

Importing virtual machines in Hyper-V is a complementary process to exporting. It involves registering a previously exported VM so that the host can manage and run it. There are several import modes, each with different uses depending on the scenario.

Import Options: Key Differences

Hyper-V allows three main types of import:

  • Local registration (on site): Use the exported files in their original location. The VM's unique identifier (ID) remains the same. This is useful for recovering a failed VM or registering an existing VM after a registration loss. No files are modified and no additional copies are generated.
  • Restore the virtual machine: Copies the exported files to a new directory chosen by the user or to the default Hyper-V folders. The VM ID remains the same, so It is necessary to delete any previous logs from the VM before importing to avoid conflicts.
  • Copy the virtual machine: Similar to restore, but in this case Hyper-V generates a new unique identifier (ID) for the imported VM. This is the ideal option for cloning VMs, creating templates, or importing the same VM multiple times on the same host.
  Understanding Arrays and Pointers in C with Clear and Practical Examples

Choosing the right type is essential: Importing with a new ID avoids SID conflicts and other problems in environments such as Active Directory or WSUS, where uniqueness is essential for proper team management.

Import from Hyper-V Manager

  1. Open Hyper-V Manager on the destination host.
  2. In the right panel, select “Import virtual machine…”
  3. Click “Next” on the welcome screen.
  4. Indicates the folder where the exported files are located.
  5. Select the desired VM from the list that appears.
  6. Choose the type of import: : record locally, restore or copy, as explained above.
  7. Configure destination locations for configuration files and disks.
  8. Review the summary of the actions and click on “Finish”.
  9. The VM will appear in the list, available to be started on the new host.

In the process, the wizard also detects hardware incompatibilities and allows you to correct memory, processor, or network adapter mismatches that may arise when moving the VM between servers with different configurations.

Import using PowerShell

The line of commands facilitates automation and management of VM batches:

  • Local registration:
    Import-VM -Path 'C:\Ruta\a\Exportacion\VM\Identificador.vmcx'
  • Restore (with copy to new locations):
    Import-VM -Path 'C:\Ruta\a\Exportacion\VM\Identificador.vmcx' -Copy -VhdDestinationPath 'D:\VMs\Discos' -VirtualMachinePath 'D:\VMs\Configuracion'
  • Copy the VM (new ID):
    Import-VM -Path 'C:\Ruta\a\Exportacion\VM\Identificador.vmcx' -Copy -GenerateNewId

Parameter -GenerateNewId generates a unique identifier to avoid host conflicts, ideal for cloning or reusing templates.

Migrations between different hypervisors: Hyper-V, VMWare and VirtualBox

clone virtualbox VM

A recurring question is how migrate virtual machines between platforms, for example, moving a VM from VMWare to Hyper-V or from VirtualBox to Hyper-V, and vice versa.

From Hyper-V to other hypervisors (VirtualBox, VMWare)

To use a Hyper-V virtual machine on other hypervisors, you will usually need to convert the virtual hard disk from VHDX format to VHD (more compatible), or directly to VMDK (VMWare) or VDI (VirtualBox) using specific tools. For this, you can consult the guide on convert virtual disks between formats.

General steps:

  1. Convert VHDX disk to VHD from Hyper-V Manager:
    • Select the VM and choose “Edit Disk…” from the actions menu.
    • Select the disk and choose the VHD output format.
    • If possible, use “dynamic expansion” to save space.
    • Save the disk to the desired location.
  2. In VirtualBox:
    • Create a new VM and choose “Use an existing virtual hard disk file.”
    • Select the converted VHD.
    • Configure memory, CPU, and if the VM is “Generation 2”, enable the “Enable EFI” option and adjust the order of Boot to avoid errors such as “no bootable medium found”.
  3. In VMWare:
    • Convert VHD to VMDK if necessary, using tools like ovftool or qemu-img.
    • Import or open the VMDK file on the new hypervisor.
  What is the anchor of the Word? What is the best way to get rid of the anchor of the Word?

Migrating from VirtualBox to Hyper-V

Conversely, to import a VirtualBox VM (.vdi format) to Hyper-V:

  • Use “VBoxManage”, the VirtualBox command-line tool, to convert the .vdi disk to .vhd:
VBoxManage clonemedium "ruta\origen.vdi" "ruta\destino.vhd" --format VHD

Create a new virtual machine in Hyper-V and select "Use existing hard drive," choosing the converted .vhd. It's crucial to select "Generation 1" for maximum compatibility.

Migrating from VMWare to Hyper-V

The process requires converting the .vmdk disk to .vhdx:

  • Unzip the OVA file or export it in OVF format from VMWare.
  • Use tools like qemu-img to convert the .vmdk disk to .vhdx:
qemu-img convert -f vmdk -O vhdx archivo.vmdk destino.vhdx

When you import the disk into Hyper-V, it creates a new VM and assigns that .vhdx as the primary disk. If the VM is Linux, it is important to previously install the drivers of Hyper-V to ensure that the system boots correctly.

Frequent problems in migrations

When working between hypervisors, virtual hardware incompatibilities (hardware version, drivers, UUIDs), boot errors due to partitioning system differences, and conflicts due to duplicate IDs in Active Directory or services like WSUS can arise.

Recommendations:

  • Always assign new IDs to cloned VMs to avoid SID conflicts.
  • Review and adjust EFI/BIOS settings as required by the exported/imported system.
  • If you're migrating VMs with LVM on Linux, make sure you add the devices correctly and adjust the lvm.conf file or /etc/fstab entries if necessary.

Limitations and safety considerations

Although useful, Hyper-V export and import is not a substitute for a professional backup solution.These processes are manual, do not include deduplication or encryption, and require administrator intervention. To protect large or productive environments, it is recommended to use specialized tools such as Microsoft Azure or native Windows Server solutions.

The export can be stored on external devices or in the cloud, but it is crucial to maintain the physical and logical security of the storage, preventing unauthorized access to exported images.

clone virtualbox VM
Related article:
How to convert virtual disks between formats with VBoxManage and other tools