stumpr
Virtuoso
Virtuoso

Working from memory here...

Your backing type in the case of a Distributed Virtual Switch Portgroup will be a 'VirtualEthernetCardDistributedVirtualPortBackingInfo'.  From that, you can get the 'portgroupKey'.  That key should be a UUID type value, which you can use to find the DistributedVirtualPortgroup by comparing it with the DistributedVirtualPortgroup.key values.  That will have a 'name' property that is probably the value you want (portgroup name).

You can probably do something like the following once you get your portgroupKey -

$pgKey = <key value from VirtualEthernetCardDistributedVirtualPortBackingInfo>;

$dvpg = find_entity_view( view_type => 'DistributedVirtualPortgroup', filter => { 'key' => $pgKey }, properties => [ 'name' ] );

print $dvpg->{'name'} . "\n";

If you were looking for speed in your script, you could fetch all the Network and DistributedVirtualPortgroup entities and store them in a hash for later lookup to avoid the multiple SDK calls.

Reuben Stump | http://www.virtuin.com | @ReubenStump