Cloning Hyper-V Virtual Machines the Right Way (Part 4)

If you would like to read the other parts in this article series please go to:


In my previous article, I explained that Hyper-V’s export function could be used as a mechanism for cloning virtual machines if you do not have System Center Virtual Machine Manager. In this article, I want to conclude the series by showing you how the export process works.

Examining an Exported Virtual Machine

Before I show you how to export a virtual machine, I want to take some time and talk about what you can expect when the export process completes. When you export a virtual machine, Windows will ask you to specify an export path.  Once the export process begins, Hyper-V creates a folder bearing the name of the virtual machine, and places the folder beneath the path that you specify. All of the various components that make up the exported virtual machine will reside within this sub folder.

The sub folder that’s named after the virtual machine contains three additional sub folders; Virtual Machines, Virtual Hard Disks, and Snapshots. The Virtual Machines folder contains an .EXP file whose full name is based on the virtual machine’s GUID. This file is the key to the cloning process, so I will be talking more about it later on.

The Virtual Hard Disks folder contains a copy of all of the virtual machine’s virtual hard disk files. Finally, the Snapshots folder contains all of the differencing disks and an .EXP file for each of the snap shots that exist for the virtual machine. If you are going to be using the virtual machine as a template for creating clones, then you should refrain from creating any snapshots. Although you can clone a virtual machine that contains snapshots, snapshots kill a virtual machine’s performance because of the way that the differencing disks are used. Having snapshots also causes the export process to take longer than it otherwise would.

In addition to the folders that I have just described, the export process also creates a file called config.xml. This file is used to store the virtual machine’s configuration. There isn’t anything special that you will have to do with this file as a part of the cloning process.

Exporting a Virtual Machine

Performing a virtual machine export is simple. As with any other cloning operation, you will want to configure the virtual machine that you want to clone (do not try to clone a production virtual server), and then run SYSPREP. Now, you can begin the actual export process. To do so, just open the Hyper-V Manager and select the virtual machine that you want to export. Next, click the Export link that is located in the console’s lower, right pane. When you do, Windows will open the Export Virtual Machine dialog box, shown in Figure A.

Figure A: Enter the path that you want to use for your exported virtual machine

At this point, you must enter a path to use as the export destination for your virtual machine. You will notice that the dialog box contains an option that you can select if you only want to export the virtual machine’s configuration. If your goal is to create a clone of the virtual machine, then you should not select this check box.

After you have entered your export path, the export process will begin. The export operation’s progress can be seen within the Hyper-V manager, as shown in Figure B. It is worth noting that depending on the size of the virtual machine that you are exporting and your hardware’s capabilities, the export process can take several hours to complete.

Figure B: The Hyper-V Manager shows the progress of the export

The Cloning Process

Now that we have exported our virtual machine, we can clone it. The first thing that you need to know about the cloning process is that Hyper-V is designed so that an exported virtual machine can only be imported once. The assumption is that you will be using the export / import process to move a virtual machine from one host server to another. The limitation of only being able to import a virtual machine once exists as a safety mechanism to avoid accidental virtual machine duplication.

In some ways this logic is flawed though. First, the export process does not remove the original copy of the virtual machine from its host server. Therefore, even if you did only import the exported virtual machine once, you could still end up with a duplicate machine on your network, unless you deleted the exported machine from its host server first.

The other reason why the logic is flawed is because we have already run SYSPREP on our virtual machine prior to exporting it. This means that we can make as many copies of the virtual machine as we want without having to worry about any of the issues that arise from having duplicate machines on the network.

The trick to being able to use your exported virtual machine as a master for the cloning process is to make a copy of the .EXP file within the Virtual Machines folder. When you import a virtual machine, it deletes the .EXP file as a way of ensuring that the virtual machine can not be imported again. Therefore, if you want to use the exported virtual machine for multiple imports, just restore a copy of the .EXP file, and you can import the virtual machine again.

Actually, there is a little bit more to the procedure than that. Before you begin the import process, you must move your exported virtual machine files to the location in which they will be used. Wherever the exported files are located when you begin the import process will be the file’s permanent location for the life of the imported virtual machine. Therefore, if you are going to use your exported virtual machine files as a template for creating clone machines, don’t use the original files. Instead, make a copy of the files, and place that copy in physical location where you want the virtual machine’s files to permanently reside.

Once you are satisfied with the file locations, click the Import Virtual Machine link found in the Hyper-V Manager’s Actions pane. Upon doing so, you will see the Import Virtual Machine dialog box, shown in Figure C. As you can see, you must simply enter the path to the copy of your exported virtual machine files that you want to import. Be sure that you do not select the Reuse Old Virtual Machine IDs check box. Otherwise, Hyper-V will try to use the same GUID for your new virtual machine as what the original copy used.

Figure C: Enter the path to the copy of your virtual machine that you want to import, and click the Import button


One of the greatest benefits to working with virtual machines is that they can be duplicated so easily. Regardless of which duplication method you choose to use though, it is important that you remember to use SYSPREP before you begin the duplication process. Otherwise, the duplication process may fail, or you may end up with a major network conflict due to having virtual machines that are completely identical.

If you would like to read the other parts in this article series please go to:

About The Author

1 thought on “Cloning Hyper-V Virtual Machines the Right Way (Part 4)”

  1. Panos Tsapralis

    Thank you very much for the nice article. But what about the source VM? I suppose that it becomes unusable since it has gone through the SYSPREP utility at the beginning of the cloning process and, when I power it up after the cloning process, I will have to go through the initial configuration process again for the source VM. What if the source VM was joined in a domain before being cloned? Do I have to manually remove the source VM from the domain before executing the SYSPREP utility on it and re-join it to the domain after the cloning or will SYSPREP and re-configuration during power-up take care of this automatically?

Leave a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top