Hi All,
Is there any script which can give both Standardswitch and Distributed Switch Portgroup Vlan name, Vlan id, total ports and available ports.
we have numerous vlan manuall efforts to check the same will be totally time consuming. if any one have such script will be most helpfull for me.
Thanks a ton in advance.
Have a look at Listing vswitch info
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks LucD for your fast response as always. .
above given link gives details of portgroup vlan tagged details.
I was mostly looking for no of available ports, total port in a portgroup. :smileyconfused:
I know, but does this work for you.
The ports can be added if I'm sure it's working
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks LucD for reply...:)
Am looking for Portgroup ports availability data., total ports data.. whats happening in my environment.. portgroup A with 250 ports and portgroup B with 250 ports.
Portgroup A filled with more than 250 VMs , which the remaining Vms not able to acquire IPs,
Where in Portgroup B with 250 Ports having 100-150 VMs only still have many ports available for VMs to get an IP.
Just want to have data it across VC of totalports and available ports in portgroup.
Try the following, but I'm not sure what you want to see for portgroups on a VSS.
There the number of ports is on the switch level, not the portgroup level afaik.
Get-VirtualPortGroup |
Select Name,
@{N='Host';E={
if($_ -is [VMware.VimAutomation.ViCore.Impl.V1.Host.Networking.DistributedPortGroupImpl]){
[string]::Join(',',(Get-View -Id $_.ExtensionData.Host -Property Name | %{$_.Name}))
}
else{
Get-View -Id $_.VMHostId | Select -ExpandProperty Name
}}},
@{N='Type';E={
if($_ -is [VMware.VimAutomation.ViCore.Impl.V1.Host.Networking.DistributedPortGroupImpl]){
'VDS'
}
else{'VSS'}}},
@{N='VlanId';E={
if($_ -is [VMware.VimAutomation.ViCore.Impl.V1.Host.Networking.DistributedPortGroupImpl]){
if($_.ExtensionData.Config.DefaultPortConfig.Vlan -is [VMware.Vim.VmwareDistributedVirtualSwitchPvlanSpec]){
$_.ExtensionData.Config.DefaultPortConfig.Vlan.PvlanId
}
elseif($_.ExtensionData.Config.DefaultPortConfig.Vlan -is [VMware.Vim.VmwareDistributedVirtualSwitchVlanSpec]){
if($_.ExtensionData.Config.DefaultPortConfig.Vlan.VlanId -is [VMware.Vim.NumericRange[]]){
[string]::Join(',',($_.ExtensionData.Config.DefaultPortConfig.Vlan.VlanId | %{"$($_.Start)-$($_.End)"}))
}
else{
$_.ExtensionData.Config.DefaultPortConfig.Vlan.VlanId
}
}
}
else{$_.VlanId}}},
@{N='Available ports';E={
if($_ -is [VMware.VimAutomation.ViCore.Impl.V1.Host.Networking.DistributedPortGroupImpl]){
$_.numPorts - $_.ExtensionData.Vm.Count
}
else{'na'}}},
@{N='Total ports';E={
if($_ -is [VMware.VimAutomation.ViCore.Impl.V1.Host.Networking.DistributedPortGroupImpl]){
$_.NumPorts
}
else{'na'}}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference