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?
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"}
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"}