Hy,
here it is sample, I'd like to get the cluster names of the resource pools...
thanx
$report = @()
$rps = Get-ResourcePool
foreach ($rp in $rps){
$row = "" | select resourcepoolname, clustername, path, cpureservation, memoryreservation
$row.resourcepoolname = $rp.name
$row.clustername = "" #I need this vale, but how???
$row.cpureservation = $rp.CpuReservationMHz
$row.memoryreservation = $rp.MemReservationMB
$rpt = Get-View -id $rp.Id
$nested = ""
while($rpt.gettype().Name -eq "ResourcePool" -and $rpt.Name -ne "Resources"){
$nested = "/" + $rpt.Name + "/" + $nested
$rpt = Get-View $rpt.Parent
}
$row.path = $nested.TrimEnd("/")
if ($row.resourcepoolname -ne "Resources") {
$report += $row
}
}
$Report | Sort-Object resourcepoolname | Sort-Object clustername
You can start off with a managed object reference of a resourcepool and traverse to it's property owner. This property, owner, will provide you the ComputeResource to which this set of one or more nested resource pools belong. Next, you can retrieve this clustercomputeresource's name property.
You can get more information on the resourceppol managed object type page in API reference guide. Hope the above helps.
Would You write a sample code, or could You give me a link to find a sample?