You can use Hyper-V Manager to live migrate VMs one by one, but to live-migrate multiple VMs simultaneously, you...
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
have to use PowerShell. In this article, we provide a few PowerShell examples to help you live-migrate Hyper-V VMs operating in and outside of a failover cluster.
PowerShell provides the Move-VM PowerShell cmdlet to live-migrate a Hyper-V VM running on one host to another host, but Move-VM only works for VMs operating outside of a Hyper-V failover cluster. For example, VMs operating in a Hyper-V shared nothing live migration model are live-migrated using the following PowerShell command:
Move-VM "SQLVM" -DestinationHost <Hyper-VHostName> -DestinationStoragePath E:\MyVM1
The command shown above moves SQLVM to the Hyper-V host specified in the -DestinationHost parameter. While that command moves a single VM, the command shown below moves all VMs running on the local Hyper-V host to a remote Hyper-V host:
Get-VM -ComputerName <LostHyper-VHost> | Move-VM–DestinationHost <Hyper-VHostName> -DestinationStoragePath E:\MyVM1
These PowerShell commands are used to live-migrate Hyper-V VMs operating outside the failover cluster. If you need to live-migrate Hyper-V VMs from one node to another node in a cluster, use the Move-ClusterVirtualMachineRole PowerShell cmdlet as shown below:
Get-VM <SQLVM> | Move-ClusterVirtualMachineRole -MigrationType Live -Node <NodeName> -Wait 0
And to live-migrate multiple Hyper-V VMs in a failover cluster, use the following PowerShell command:
Get-VM | Move-ClusterVirtualMachineRole -MigrationType Live -Node <NodeName> -Wait 0
The -Wait 0 parameter above specifies that the PowerShell cmdlet runs and then returns to the PowerShell prompt without waiting.
Dig Deeper on Microsoft Hyper-V management
Related Q&A from Nirmal Sharma
System Center Orchestrator provides Run .Net Script activity, which can be used to call PowerShell scripts, but there are limitations you should know.continue reading
By referencing various log files, like the Real-Time Log and the Historic Log, and checking the Orchestrator Runbook Audit History page, you can more...continue reading
To execute custom scripts for Azure Windows and Linux VMs to support post-deployment configurations, you'll have to download the Azure Custom Script ...continue reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.