LucD
Leadership
Leadership

One way of doing this is with the modulo operator (%), something like this

$numVMs =11

$tgtEsx = Get-Cluster 'Westcreek' | Get-VMHost -Name z420*

1..$numVMs | %{

    New-VM -Name "Test$($_)" -VMHost $tgtEsx[$_%$tgtEsx.Count]

}


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

View solution in original post

Reply
0 Kudos