You can use Hyper-V Manager to live migrate VMs one by one, but to live-migrate multiple VMs simultaneously, you...
Continue Reading This Article
Enjoy this article as well as all of our content, including E-Guides, news, tips and more.
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
You also agree that your personal information may be transferred and processed in the United States, and that you have read and agree to the Terms of Use and the Privacy Policy.
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.