VMware Cloud Community
ben1985
Contributor
Contributor
Jump to solution

Get-VirtualPortGroup issue

I would like to return all Virtual Machine Port Groups within a vCenter using the Get-VirtualPortGroup command. Unfortunately, this also returns VMkernel Ports as well. Is there a way to only return the Virtual Machine Port Groups?

0 Kudos
1 Solution

Accepted Solutions
deang1609
Enthusiast
Enthusiast
Jump to solution

You could use the below to only select the objects retrieved which are not equal to the Port.Type value 'host', this should only then retrieve virtual machine port groups.

Get-VirtualPortGroup | Where-Object {$_.Port.Type -ne "host"}

Dean Grant Blog: deangrant.wordpress.com | Twitter: @dean1609 | GitHub: https://github.com/dean1609

View solution in original post

0 Kudos
1 Reply
deang1609
Enthusiast
Enthusiast
Jump to solution

You could use the below to only select the objects retrieved which are not equal to the Port.Type value 'host', this should only then retrieve virtual machine port groups.

Get-VirtualPortGroup | Where-Object {$_.Port.Type -ne "host"}

Dean Grant Blog: deangrant.wordpress.com | Twitter: @dean1609 | GitHub: https://github.com/dean1609
0 Kudos