Cet article est disponible en francais.

Hyper-V is a wonderful tool, and provides great performance and stability. But on the administration side, available tools are a bit scare, and even though most general operations are available, some are a bit hard to use. One can guess that this will improve in Windows Server 2008 R2.

But for now, the administration tools do not provide any mean to import a VM that has not been previously exported. Exporting a VM can only be done on the original host server while it is still running. In the case of a crashed server, exporting a VM becomes a bit more complex.

Some techniques do exist, here and there, that explain by means of mklink and icacls, how to recreate symbolic links and file permissions for the VM configuration files. But that stays a particularly complex task, mostly because all files must be modified, and a specific order must be respected for all modifications. And this is especially true for the case of a running host server.

After having dug in Hyper-V symlinks and WMI interface, I created a GUI tool that allows to attach and detach VM that have not been previously epoxted.

Some thougts on this tool :

  • A VM can only be detached if it is in the "Saved" or "Stopped" state.
  • It is not necessary to stop the Hyper-V service and all modifications are detected live by the service.
  • A VM can only be imported if it contains at least on HDD on the IDE 0 controller.
  • All the VM files must be under the same directory, HDD and snapshots.
  • All files that are modified are backed-up next to the original files; All other files are not modified nor moved.
  • .NET 3.5 must be installed.

I'll provide the sources for this tool in a near future, as well as a console version.

Of course, there will be bugs, and do not hesitate to report them to me. I may not be able to do anything about it because it is a tool that performs a operation that is (I assume) not supported by Microsoft.

You can download the tool here.