I seem to be going round in circles on this one.
Is there an easy way to to query the vDS and return the hostnames of the connected ESX hosts?
I can get it using Moref via the following kind of thing:
Get-VDSwitch | ForEach {
$SwMORefs = $_.ExtensionData.Config.host.config.host.value
$SwitchName = $_.Name
$SwitchName
ForEach ($MR in $SwMORefs) {
$AttachedHost = Get-VMHost | Where {$_.ExtensionData.MoRef -match $MR}
$AttachedHost
}
}
...but this seems a bit complex and slow?
Is this a bit faster?
Get-View -Id $vds.ExtensionData.Config.host.config.host -Property Name |
Select @{N='vdSwitch';E={$vds.Name}},Name
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Is this a bit faster?
Get-View -Id $vds.ExtensionData.Config.host.config.host -Property Name |
Select @{N='vdSwitch';E={$vds.Name}},Name
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Perfect thank you, I really need to start using Get-View a lot more.