Try something like this
$esx = Get-VMHost MyEsx
$parent = $esx.ExtensionData.Parent
$loc = Get-View $parent
while($loc.getType().Name -ne "Datacenter"){
$parent = $loc.Parent
$loc = Get-View $parent
}
$loc.Name
Try something like this
$esx = Get-VMHost MyEsx
$parent = $esx.ExtensionData.Parent
$loc = Get-View $parent
while($loc.getType().Name -ne "Datacenter"){
$parent = $loc.Parent
$loc = Get-View $parent
}
$loc.Name