If I have a cluster name Cluster123. How do I find the location of this cluster? for example, YellowFolderA/YellowFolderB/Cluster123
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
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
Thank you
How do I find the available property after "ExtensionData" in this case "ResourcePool" for the object?
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