Get-VirtualSwitch -Name MyDVSwitch | Get-VirtualPortGroup | `
Select Name, @{N="VLANId";E={$_.Extensiondata.Config.DefaultPortCOnfig.Vlan.VlanId}}
This has worked for me on vSphere 5.1. But does not pick up vlanid parameter on 4.1. Is that expected?