HYPER-V Host has a feature to Import a new Virtual Machine or Live Migration between 2 different HYPER-V Hosts.
As IT Pro i would like to know if the Virtual Machine that you want to transfer is compatible in the new HYPER-V Host. Especially if the Virtual Machine is a critical System in your Production environment or a huge File Server.
I don't want to start an Import or a Live Migration and in the middle of Migration get errors that must resolve it.
But how i know if the transfer will be done successful?
Powershell has a command Compare-VM which can use it for Incompatibilities Reports before start or through the Import or Live Migration process in the new HYPER-V Host.
I have talk in previous Article for Compare-VM Export & Import Virtual Machine in HYPER-V with Powershell but today i would like to show you a combination of GUI with Powershell to reduce time and avoid errors while start to Import the VM in the new HYPER-V Host.
Let's start to explain how can use it.
Configurations before use Compare-VM
- If you start to use Compare-VM without do the configurations that need then you will get some errors.
- Open Powershell and type
Compare-VM -name <name of VM> -Destination host <name of destination HYPER-V Host> - As you can see you get an error.
- To fix the error follow the steps in source and destination HYPER-V Host.
- Open HYPER-V Manager
- Click in HYPER-V Settings from the right side
- Click in Live Migrations
- Select use these IP Addresses for Live Migrations. Click Add and type the Ip Address of your HYPER-V Host. Click OK.
- Now go back in Powershell and run the Command.
- You will see that will get the Incompatibility Report.
- Except from Incompatibilities this command create a new folder with the name of the VM in the Destination HYPER-V Host with a subfolder Planned Virtual Machine.
- What is Planned Virtual Machine?
It's a new future of Hyper-V WMI v2 which can use this folder when migrate a Virtual Machine to make configuration and changes prior the import process base on Taylor Brown in his article Importing VMs Utilizing The Hyper-V WMI v2 Namespace
Export VM from HYPERV-Host
You can find the Process in the following Articles which include GUI or Powershell. Export the Virtual Machines and copy the VHD or VHDX File in the Destination Folder of HYPER-V Host which included all the VHD or VHDX Files.
Export & Import Virtual Machine in HYPER-V
Export & Import Virtual Machine in HYPER-V with Powershell
The VHD or VHDX Files will use it in the following Steps.
View Report and Resolve an Incompatibility Errors
So now we have Export the Virtual Machine in a separate folder and we have copy the VHD or VHDX File in the Destination HYPER-V Host.
Now it's time to run compare-vm and view the Incompatibility Report.
Run again the following command to get the Report
Compare-VM -name <name of VM> -Destination host <name of destination HYPER-V Host>
If you don't have any error then you can proceed with migration of your VM in new Hyper-v Host.
But if you have errors read below to see how can face it.
- While type the command you will get a Report with few details. You can see only the error numbers.
- Type the following commands
$report = compare-vm -name test-pc -destinationhost hyperv2
$report.incompatibilities | ft -wrap - Now you can see more details for your errors that you get.
- So you can start to troubleshoot the errors.
- As you can see in my own report i have few errors with numbers 21026,24000,40010.
- The most common error is the 40010. But why this error appear?
- Two reasons can create this error
- Different path of the VHD or VHDX File in the Destination Host.
If you must change the path of the VHD or VHDX file in the destination Host read the Article of Ber Anstrong Importing a VM with VHDs in Different Paths how can resolve this issue.
- You don't have copy VHD or VHDX File in the Destination Host.
- In this scenario the error created because i didn't copy the VHD or VHDX Files in the Destination HYPER-V Host.
- After copy the VHDX File in the Destination HYPER-V Host i run once the commands and as you can see i am ready to start the Import or Live Migration of the Virtual Machive because i don't have any error.
$report = compare-vm -name test-pc -destinationhost hyperv2
$report.incompatibilities | ft -wrap
Import Virtual Machine in the Destination Host
After Verify that no incompatibilities Errors exist from the Report then you are ready to proceed with the Import of Virtual machine in the Destination HYPER-V Host.
Follow the Procedure of the Article fro GUI Environment
Export & Import Virtual Machine in HYPER-V
When has finish with the Import then go in the Folder of the Imported VM and open the Planned Virtual Machine Folder. As you can see is empty.
I found this method to Import a VM in new Destination Host very usefully because you can prevent errors prior import or Migrate.
You are sure for the Results when start a Live Migration or Import VM in new HYPER-V Host.
Now it's your turn to try it when you have a VM to transfer in new HYPER-V Host and share your experience in our commented system or in Social Media Google+ Twitter and Facebook