vSphere PowerCLI Reference

Get-VirtualPortGroup

Synopsis

Retrieves the available port groups of hosts, virtual machines, and virtual switches.

Syntax

Get-VirtualPortGroup [-Id <String[]>] [[-VMHost] <VMHost[]>] [-VM <VirtualMachine[]>] [-VirtualSwitch <VirtualSwitchBase[]>] [-Name <String[]>] [-Datacenter <Datacenter[]>] [-Standard] [-Distributed] [-Server <VIServer[]>] [<CommonParameters>]

Related Commands

Online version
New-VirtualPortGroup
Remove-VirtualPortGroup
Set-VirtualPortGroup

Detailed Description

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.

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
VMHostVMHost[]Specify the hosts whose port groups you want to retrieve. The position of this parameter is deprecated and will be changed in a future release. To avoid errors when you run existing scripts on future PowerCLI versions, specify the parameter by name.falsetrue (ByValue)
DatacenterDatacenter[]Filter the port groups of the virtual switches connected to hosts in the specified datacenters.falsetrue (ByValue)
DistributedSwitchParameterIndicate that you want to retrieve the port groups for DistributedSwitch objects.falsefalse
IdString[]Specify the Ids of the port groups you want to retrieve.falsefalse
NameString[]Specify the names of the port groups you want to retrieve.falsefalse
ServerVIServer[]Specify the vSphere servers on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer.falsefalse
StandardSwitchParameterIndicate that you want to retrieve the port groups for VirtualSwitch objects.falsefalse
VirtualSwitchVirtualSwitchBase[]Specify the virtual switches for which you want to retrieve their port groups.falsetrue (ByValue)
VMVirtualMachine[]Specify the virtual machines whose port groups you want to retrieve.falsetrue (ByValue)

Return Type

VirtualPortGroup

Notes

Examples

-------------- Example 1 --------------

$vswitch = New-VirtualSwitch -VMHost 10.23.112.123 -Name VSwitch  New-VirtualPortGroup -VirtualSwitch $vswitch -Name PortGroup  Get-VirtualPortGroup -VirtualSwitch $vswitch

Creates a virtual switch named VSwitch on the host with IP address 10.23.112.123. Creates a new virtual ports group named PortGroup for the new switch. Retrieves the virtual ports groups of VSwitch.


Copyright © 1998 - 2011 VMware, Inc. All rights reserved.