VMware Cloud Community
bairstowscott
Contributor
Contributor
Jump to solution

How do I find the location of a cluster?

If I have a cluster name Cluster123. How do I find the location of this cluster? for example, YellowFolderA/YellowFolderB/Cluster123

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Try something like this

$clusterName = "MyCluster"

$path = @()
$cluster = Get-Cluster -Name $clusterName
$parent = Get-View $cluster.ExtensionData.ResourcePool
while ($parent.parent){
 
$parent = Get-View $parent.parent
 
$path += $parent.Name
}
[
array]::Reverse($path)
[
string]::Join('/',$path)


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

View solution in original post

0 Kudos
3 Replies
LucD
Leadership
Leadership
Jump to solution

Try something like this

$clusterName = "MyCluster"

$path = @()
$cluster = Get-Cluster -Name $clusterName
$parent = Get-View $cluster.ExtensionData.ResourcePool
while ($parent.parent){
 
$parent = Get-View $parent.parent
 
$path += $parent.Name
}
[
array]::Reverse($path)
[
string]::Join('/',$path)


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

0 Kudos
bairstowscott
Contributor
Contributor
Jump to solution

Thank you

How do I find the available property after "ExtensionData" in this case "ResourcePool" for the object?

0 Kudos
LucD
Leadership
Leadership
Jump to solution

The objects that is accessible through the ExtensionData property, or through the Get-View cmdlet, are in fact the vSphere object as documented in the SDK Reference.

In this case I started from the ClusterComputeResource object.


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

0 Kudos