That worked, thank you.
Original Message:
Sent: Nov 06, 2024 03:42 PM
From: LucD
Subject: Add a filter on get-view to only return results from a specific cluster
You can use the Server parameter on the Get-Cluster cmdlet
Get-View -ViewType VirtualMachine -SearchRoot ((Get-Cluster -Name MyCluster -Server MyvCenter).ExtensionData.MoRef) -Property Parent, Config, Summary, Runtime
------------------------------
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
------------------------------
Original Message:
Sent: Nov 06, 2024 03:09 PM
From: dbutch1976
Subject: Add a filter on get-view to only return results from a specific cluster
Thanks LucD, works great, however I'm still having an issue with my results. It appears that there are many VMs which are replicated, so I believe that may be why I'm getting results from multiple vCenters like this:
Name: MyVM
Cluster : {MYCLUSTERDR, MYCLUSTER, MYCLUSTER3}
When exported to csv the field simply says System.Object[]
Can I and an additional qualifier to -SearchRoot ? Something like -SearchRoot ((Get-Cluster -Name MyCluster).ExtensionData.MoRef) -and ([uri]$_.Client.ServiceUrl).MYVCENTER ?
The goal would be to further isolate my results to one vCenter while remaining connected to all of them.
Original Message:
Sent: Nov 06, 2024 01:59 PM
From: LucD
Subject: Add a filter on get-view to only return results from a specific cluster
Use the SearchRoot parameter instead.
Get-View -ViewType VirtualMachine -SearchRoot ((Get-Cluster -Name MyCluster).ExtensionData.MoRef) -Property Parent, Config, Summary, Runtime
------------------------------
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference