Reply to Message

View discussion in a popup

Replying to:
LucD
Leadership
Leadership

That is what you script is doing, you're getting all the VMs for each iteration through data/cluster.

To limit it to only to the VMs in a cluster, use the SearchRoot parameter.

Replace the line with

$vms = Get-view -ViewType VirtualMachine -SearchRoot $cluster.ExtensionData.MoRef


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