Trigger Multiple Concurrent Live Migrations Using PowerShell

Learn how to trigger multiple concurrent Live Migrations by using Windows PowerShell 3.0.

John Savill

August 11, 2013

1 Min Read
Trigger Multiple Concurrent Live Migrations Using PowerShell

Q: How can I trigger multiple concurrent Live Migrations using Windows PowerShell?
A: It's easy to trigger multiple Live Migrations using PowerShell, for example:

Get-VM blank1,blank2,blank3 | Move-VM -DestinationHost savdalhv02

The problem is, this would Live Migrate blank1, and after that finished, it would Live Migrate blank2, then after that finished, Live Migrate blank3 and so on. But it isn't performing a simultaneous Live Migration, which is possible in Windows Server 2012.

One solution is to use the -parallel option, available in PowerShell 3.0 workflows to trigger the Live Migrations to occur in parallel. For example:

Workflow Invoke-ParallelLiveMigrate{    $VMLIST = get-vm blank1,blank2,blank3,blank4,blank5,blank6    ForEach -Parallel ($VM in $VMLIST)    {        Move-VM -Name $VM.Name -DestinationHost savdalhv02    }}Invoke-ParallelLiveMigrate

The Live Migrations will now occur in parallel (make sure your Hyper-V hosts are configured with the necessary setting for the number of concurrent Live Migrations you want to perform on both the source and destination Hyper-V hosts).

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like