pizzim13
Contributor
Contributor

Any way to throttle asynchronous tasks?

For example,

foreach ($VM in $VMS)
     {
     Move-VM -VM $VM -Datastore $Datastore -RunAsync
     }

and make so that only X amount of SvMotions are running concurrently. Once one finishes, the next one would start. I assume I would use Get-Task to count how many jobs are running.

Reply
0 Kudos
LucD
Leadership
Leadership

Note that vSphere itself already throttles the number of parallel vMotions.

If you want to divert from the number of parallelism from vSphere, you will have to indeed use the Get-Task cmdlet and monitor the number of "running" tasks of type vMotion.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos