vSphere PowerCLI Reference



Changes the properties of the specified virtual port group.


Set-VirtualPortGroup [-Name <String>] [-VLanId <Int32>] [-VirtualPortGroup] <VirtualPortGroup[]> [-WhatIf] [-Confirm] [<CommonParameters>]

Related Commands

Online version

Detailed Description

Changes the properties of the specified virtual port group.


NameTypeDescriptionRequired?Pipeline InputDefault Value
VirtualPortGroupVirtualPortGroup[]Specify the virtual port group whose properties you want to change.truetrue (ByValue)
ConfirmSwitchParameterIf the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation.falsefalse$true
NameStringSpecify a new name for the virtual port group.falsefalse
VLanIdInt32Specify the VLAN ID for ports using this port group. The following values are valid:

0 - specifies that you do not want the port group associated with a VLAN.

1 to 4094 - specifies a VLAN ID for the port group.

4095 - specifies that the port group should use trunk mode, which allows the guest operating system to manage its own VLAN tags.
WhatIfSwitchParameterIndicate that the cmdlet is run only to display the changes that would be made and actually no objects are modified.falsefalse

Return Type




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

$vswitch =  New-VirtualSwitch -VMHost -Name VSwitch  $vportgroup1 =  New-VirtualPortGroup -VirtualSwitch $vswitch -Name VPortGroup1  $vportgroup2 = Set-VirtualPortGroup -VirtualPortGroup $vportgroup1 -VLanId 1

Creates a new virtual switch named VSwitch on the virtual machine host with IP address Creates a new virtual port group for the new switch named VPortGroup1. Sets the VLAN ID for the ports using the Ports02_19 group.

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