VMware Cloud Community
vmwarelicense12
Enthusiast
Enthusiast
Jump to solution

Get port group name from DVPort id

How do I get a port group name from an port ID?

I have a list of port id´s and want to find the port groups name from this list.

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

You could do something like this.
Note that if you have multiple VDS, the same portId might be used on several of the VDS.

$portIds = 12,13,14,15

$ports = Get-VDSwitch | Get-VDPort

foreach($portId in $portIds){

    $ports | where{$_.Key -eq $portId} | Select Key,Name,ConnectedEntity,Switch,Portgroup

}


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

View solution in original post

Reply
0 Kudos
4 Replies
LucD
Leadership
Leadership
Jump to solution

Are these on VSS or VDS switches?


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

Reply
0 Kudos
vmwarelicense12
Enthusiast
Enthusiast
Jump to solution

They are on dvs

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

You could do something like this.
Note that if you have multiple VDS, the same portId might be used on several of the VDS.

$portIds = 12,13,14,15

$ports = Get-VDSwitch | Get-VDPort

foreach($portId in $portIds){

    $ports | where{$_.Key -eq $portId} | Select Key,Name,ConnectedEntity,Switch,Portgroup

}


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

Reply
0 Kudos
vmwarelicense12
Enthusiast
Enthusiast
Jump to solution

Just what I was looking for. Thanks.

Reply
0 Kudos