If you have Hyper-V running on Windows Server 2008 R2 in a cluster, there are times when you will need to live migrate all virtual machine guests to another host for scheduled planned maintenance on a specific host. You can live migrate all virtual machines one by one, one after the other from one host to another host by automatically running the following PowerShell script:
get-cluster "$CL" | Get-Clusternode "$SH" | Get-ClusterGroup | Move-ClusterVirtualMachineRole -node "$DH"
As an example: get-cluster "dc-au-hvc-03" | Get-Clusternode "dc-au-hv-12" | Get-ClusterGroup | Move-ClusterVirtualMachineRole -node dc-au-hv-13
If you want to live migrate one specific virtual machine from one node to another:
get-cluster "$CL"| Move-ClusterVirtualMachineRole -name "SCVMM $VM Resources" -node "$DH"