Hello! I'm in the process of creating a script that gets all VDPortgroups and copies them to a Standard Switch for migration purposes. Our DVS is currently a Cisco 1000v. I would like to be able to extract the VLAN ID from each VDPortgroup so I can in turn set that VLAN ID on the Standard Switch after its creation. I have not been able to find a VLAN ID property anywhere in the VDPortgroup object (I've drilled down into ExtensionData, etc. with no luck).
As a workaround, I've been relying on the VLAN being in the Name of the VDPortgroup and using regex to extract that number value out of the name, store it in a variable, and set the VLAN ID on the port group on the Standard Switch accordingly. However, I would love to not have to rely on the cosmetic naming being 100 % accurate and consistent with the actual VLAN ID of all of the VDPortgroups we have out there, which is quite a few.
Is there a VLAN ID property hidden somewhere that I'm not finding within the VDPortgroup object? Or is there a better way to do this? Any thoughts or suggestions would be much appreciated!
Best,
Alex
I went through a migration last year and I found that the 1000v does not advertise that information to vCenter, unfortunately. Your best bet is to parse it from the name, if available.
I know you're not on a VMware DVS, but if you set one up, you could see that the port group has a VLAN config (somewhere under portgroup.config.vlan.vlanid or similar). Cisco leaves this out on their distributed switch, for some unknown reason.
Have a look at Re: Backup of dvSwitch, it handles VLANid from VSS and VDS.
Haven't tried with a Nexus though.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks. Unfortunately there does not look to be a VLAN property within 'DefaultPortConfig':
Must be a limitation with the 1000v.
Bummer
If you have the time, you could use the Show-Object function, from Lee Holmes's PowerShell Cookbook, to further explore the 1000v object.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I went through a migration last year and I found that the 1000v does not advertise that information to vCenter, unfortunately. Your best bet is to parse it from the name, if available.
I know you're not on a VMware DVS, but if you set one up, you could see that the port group has a VLAN config (somewhere under portgroup.config.vlan.vlanid or similar). Cisco leaves this out on their distributed switch, for some unknown reason.
That's really good to know, appreciate the info. I should be able to parse it from the name in most cases but I know there are at least a few one-offs where the name does not contain the VLAN ID. Sounds like the best course of action will be to identify those one-offs out front before the migration and then build in some conditional logic to address them on the 'Set-VirtualPortGroup' segment.