VMware Cloud Community
GarTomlon
Enthusiast
Enthusiast
Jump to solution

VLanID using Get-VirtualPortGroup

Trying to retireve Vlan Ids of my VIrturalPortgroups using powercli.  I can see the VLanIds clearly in the GUI; however, if using Get-VirtualPortGroup command in powercli, it retrieves all other Info, however, VlanID is blank.  

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

If you are working with VSS, not VDS, you could do

Get-VirtualPortGroup -Standard |
Select-Object Name,
    @{N='VLAN';E={$_.ExtensionData.Config.DefaultPortConfig.Vlan.VlanId}}

If you also want to report on VDS have a look at Solved: Re: List Portgroups with Private VLANS - VMware Technology Network VMTN

 


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

If you are working with VSS, not VDS, you could do

Get-VirtualPortGroup -Standard |
Select-Object Name,
    @{N='VLAN';E={$_.ExtensionData.Config.DefaultPortConfig.Vlan.VlanId}}

If you also want to report on VDS have a look at Solved: Re: List Portgroups with Private VLANS - VMware Technology Network VMTN

 


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
GarTomlon
Enthusiast
Enthusiast
Jump to solution

Thanks so much.  These were all going to be VDI so used your link .  Worked like a champ

#Get portgroup
    $nadapter = Get-NetworkAdapter -vm $imageName
    $vPGName = $nadapter.NetworkName
    $vPortGroup = Get-VirtualPortGroup | Where-Object { $_.Name -eq $vPGName }
    $vlanId = $vPortGroup.ExtensionData.Config.DefaultPortConfig.Vlan.VlanId
Reply
0 Kudos