Set-VirtualPortGroup Command | Vmware PowerCLI Reference


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


-VirtualPortGroup < VirtualPortGroup[] >
[-Name < String > ]
[-VLanId < Int32 > ]


Required Parameter Name Type Position Features Description
VirtualPortGroup VirtualPortGroup[] named
  • pipeline
Specifies the virtual port group whose properties you want to change.
optional Name String named
Specifies a new name for the virtual port group.
optional VLanId Int32 named
Specifies the VLAN ID for ports using this port group. The following values are valid: 0 - specifies that you do not want to associate the port group 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.




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 VPortGroup1 group.

Related Commands


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.