Get-VirtualPortGroup Command | Vmware PowerCLI Reference

Get-VirtualPortGroup

This cmdlet retrieves the available port groups of hosts, virtual machines, and virtual switches. To specify a server different from the default one, use the Server parameter.

Syntax

Get-VirtualPortGroup
-Id < String[] >
[-ProgressAction < ActionPreference > ]
[-Server < VIServer[] > ]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
required
Id String[] named
  • wildcards
Specifies the IDs of the port groups you want to retrieve. Note: When a list of values is specified for the Id parameter, the returned objects would have an ID that matches exactly one of the string values in that list.
optional ProgressAction ActionPreference named
optional Server VIServer[] named
  • wildcards
Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is provided or $null value is passed to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer.

Output

VMware.VimAutomation.ViCore.Types.V1.Host.Networking.VirtualPortGroupBase

Examples

Example 1

Get-VirtualPortgroup -Name "VM Network"

Retrieves all port groups named "VM Network".

Example 2

$myVMHost = Get-VMHost -Name "MyVMHost"Get-VirtualPortGroup -Name "VM Network" -VMHost $myVmHost

Retrieves the port group named "VM Network" on the specified host.

Example 3

$myVM = Get-VM -Name "MyVM"Get-VirtualPortGroup -VM $myVM

Retrieves all port groups to which the specified virtual machine is connected.

Example 4

$virtualSwitch = Get-VirtualSwitch -VMHost MyVMHost -Name vSwitch0Get-VirtualPortGroup -VirtualSwitch $virtualSwitch

Retrieves all port groups which belong to the specified virtual switch.

Related Commands

VirtualPortGroup

This cmdlet retrieves the available port groups of hosts, virtual machines, and virtual switches.

This cmdlet creates a new port group on the specified host.

This cmdlet removes the specified virtual port groups.

This cmdlet modifies the properties of the specified virtual port group.