- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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