I am trying to find the name of the Cluster of a Resource Pool in vCenter. Tried running Get-ResourcePool, but couldn't find cluster info.
My input would be -
> name of ResourcePool
> name of vCenter and credentials
and get the name of cluster where the resource pool is created. Could someone help please?
Try like this
$vCenter = 'MyVC'
$rPool = 'MyRP'
$rp = Get-ResourcePool -Name $rPool
$cluster = $rp.Parent
while($cluster -isnot [VMware.VimAutomation.ViCore.Types.V1.Inventory.Cluster]){
$cluster = $cluster.Parent
}
$cluster.Name
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Try like this
$vCenter = 'MyVC'
$rPool = 'MyRP'
$rp = Get-ResourcePool -Name $rPool
$cluster = $rp.Parent
while($cluster -isnot [VMware.VimAutomation.ViCore.Types.V1.Inventory.Cluster]){
$cluster = $cluster.Parent
}
$cluster.Name
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference