VMware Cloud Community
DanyG01
Enthusiast
Enthusiast

Get List of Portgroups

Hi,

  I would like to get a list of portgroup for a specific switch.

In powershell I use this command:   Get-VDPortgroup -VDSwitch "switch name"

How can I do that in vCO?

Thanks

0 Kudos
1 Reply
jmedd
Enthusiast
Enthusiast

For Standard switches and portgroups you can use the inbuilt action:

com.vmware.library.vc.networking: getVSwitchPortgroups

For Distributed switches and portgroups create an action with the following:

IN:

DvSwitch: VC:VmwareDistributedVirtualSwitch

Return type:

VC:DistributedVirtualPortgroup

Code:

var DvPortgroups = DvSwitch.portgroup;

return DvPortgroups

I uploaded a copy of the getDvSwitchPortGroups.action action to GitHub so you don't need to create it yourself.

Blog: http://jonathanmedd.net | Twitter: @jonathanmedd
0 Kudos