- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, got it (I think).
Try like this
Get-VDSwitch |
Select Name,
@{N='Total Ports';E={$_.NumPorts}},
@{N='Available Ports';E={
$vds = $_
$hPorts = $vds.ExtensionData.Config.Host.UplinkPortKey.Count
$vPorts = (Get-View -Id $vds.ExtensionData.Summary.Vm | %{
$_.Config.Hardware.Device |
where{$_.Backing -and
$_.Backing.GetType().Name -match "distributed" -and
$_.Backing.Port.SwitchUuid -eq $vds.ExtensionData.Uuid}}).Count
$vds.NumPorts - $hPorts - $vPorts
}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference