New-VirtualPortGroup Command | Vmware PowerCLI Reference

New-VirtualPortGroup

This cmdlet creates a new port group on the host using the provided parameters.

Syntax

New-VirtualPortGroup
[ -VirtualSwitch ] < VirtualSwitch >
-Name < String >
[-ProgressAction < ActionPreference > ]
[-Server < VIServer[] > ]
[-VLanId < Int32 > ]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
required
VirtualSwitch VirtualSwitch 1
  • pipeline
  • wildcards
Specifies the virtual switch for which you want to create a new port group.
required
Name String named
Specifies a name for the new port group.
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.
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.

Output

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

Examples

Example 1

$vswitch =  New-VirtualSwitch -VMHost 10.23.114.234 -Name VSwitch

$vportgroup =  New-VirtualPortGroup -VirtualSwitch $vswitch  -Name VPortGroup

Creates a virtual port group named VPortGroup on the virtual switch VSwitch.

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.