New-VDPortgroup Command | Vmware PowerCLI Reference

New-VDPortgroup

This cmdlet creates distributed port groups. You can create a new distributed port group with custom properties, specify a reference port group to clone its properties, or provide a backup profile to import the port group configuration.

Syntax

New-VDPortgroup
-Name < String >
-VDSwitch < VDSwitch >
[-Notes < String > ]
[-NumPorts < Int32 > ]
[-PortBinding < DistributedPortGroupPortBinding > ]
[-RunAsync ]
[-Server < VIServer[] > ]
[-VlanId < Int32 > ]
[-VlanTrunkRange < VlanRangeList > ]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
required
Name String named
Specifies the name of the new distributed port group that you want to create.
required
VDSwitch VDSwitch named
  • pipeline
  • wildcards
Specifies the vSphere distributed switch on which you want to create the new distributed port group.
optional Notes String named
Specifies a description for the new distributed port group that you want to create.
optional NumPorts Int32 named
Specifies the number of ports that the distributed port group will have. If you do not set this parameter, the number of ports for the new distributed port group is set to 128 ports.
optional PortBinding DistributedPortGroupPortBinding named
Specifies the port binding setting for the distributed port group that you want to create. This parameter accepts Static, Dynamic, and Ephemeral values. Note: Dynamic port binding is deprecated. For better performance, static port binding is recommended.
optional RunAsync SwitchParameter named
Indicates that the command returns immediately without waiting for the task to complete. In this mode, the output of the cmdlet is a Task object. For more information about the RunAsync parameter run "help About_RunAsync" in the VMware PowerCLI console.
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 of the distributed port group that you want to create. Valid values are integers in the range of 1 to 4094.
optional VlanTrunkRange VlanRangeList named
Specifies the VLAN trunk range for the distributed port group that you want to create. Valid values are strings representing ranges of IDs. For example, "1-4, 6, 8-9".
New-VDPortgroup
-BackupPath < String >
-VDSwitch < VDSwitch >
[-KeepIdentifiers ]
[-Name < String > ]
[-RunAsync ]
[-Server < VIServer[] > ]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
required
BackupPath String named
Specifies the full file path to the .zip file containing the backup configuration that you want to import. Only .zip files created with the Export-VDPortgroup cmdlet are supported. Note: This parameter is supported only on vSphere 5.1 and later.
required
VDSwitch VDSwitch named
  • pipeline
  • wildcards
Specifies the vSphere distributed switch on which you want to create the new distributed port group.
optional KeepIdentifiers SwitchParameter named
Indicates that the original vSphere distributed port group identifiers will be preserved. Note: This parameter is supported only on vSphere 5.1 and later.
optional Name String named
Specifies the name of the new distributed port group that you want to create.
optional RunAsync SwitchParameter named
Indicates that the command returns immediately without waiting for the task to complete. In this mode, the output of the cmdlet is a Task object. For more information about the RunAsync parameter run "help About_RunAsync" in the VMware PowerCLI console.
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.
New-VDPortgroup
-ReferencePortgroup < VDPortgroup >
-VDSwitch < VDSwitch >
[-Name < String > ]
[-RunAsync ]
[-Server < VIServer[] > ]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
required
ReferencePortgroup VDPortgroup named
  • pipeline
  • wildcards
Specifies a reference distributed port group. The properties of the new distributed port group will be cloned from the reference distributed port group. Note: This parameter is supported only on vSphere 5.1 and later.
required
VDSwitch VDSwitch named
  • pipeline
  • wildcards
Specifies the vSphere distributed switch on which you want to create the new distributed port group.
optional Name String named
Specifies the name of the new distributed port group that you want to create.
optional RunAsync SwitchParameter named
Indicates that the command returns immediately without waiting for the task to complete. In this mode, the output of the cmdlet is a Task object. For more information about the RunAsync parameter run "help About_RunAsync" in the VMware PowerCLI console.
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.Vds.Types.V1.VDPortgroup

Examples

Example 1

Get-VDSwitch -Name "MyVDSwitch" | New-VDPortgroup -Name "MyVDPortGroup" -NumPorts 8 -VLanId 4

Creates a new distributed port group on the specified vSphere distributed switch with the specified number of ports and VLAN ID.

Example 2

$myReferncePortroup = Get-VDPortgroup -Name "MyReferencePortGroup"
Get-VDSwitch -Name "MyVDSwitch" | New-VDPortgroup -Name "MyVDPortGroup" -ReferencePortgroup $myReferncePortroup

Creates a new distributed port group on the specified vSphere distributed switch by cloning the configuration of the distributed port group named "MyReferencePortGroup".

Example 3

Get-VDSwitch -Name "MyVDSwitch" | New-VDPortgroup -Name "MyVDPortGroup" -RunAsync

Creates asynchronously a new distributed port group on the specified vSphere distributed switch.

Example 4

$myBackupFilePath = 'c:\Backup.zip'
Get-VDSwitch -Name "MyVDSwitch" | New-VDPortgroup -Name "MyVDPortgroup" -BakupPath $myBackupFilePath

Creates a new distributed port group on the specified vSphere distributed switch by importing the specified backup profile.

Example 5

Get-VDSwitch -Name "MyVDSwitch" | New-VDPortgroup -Name "MyVDPortGroup" -VlanTrunkRange "1-5, 10-20"

Creates a new distributed port group on the specified vSphere distributed switch with the specified name and VLAN trunk range settings.

Related Commands

VDPort

This cmdlet retrieves virtual distributed ports.

This cmdlet modifies the configuration of virtual distributed ports.

VDPortGroup

This cmdlet exports the configuration of a specified distributed port group to a specified .zip file.

This cmdlet removes distributed port groups.

VDPortgroup

This cmdlet retrieves distributed port groups.

This cmdlet creates distributed port groups.

This cmdlet modifies the configuration of distributed port groups.

VDPortgroupOverridePolicy

This cmdlet retrieves the policy for overriding port group settings at port level.

This cmdlet modifies the policy for overriding port group settings at port level.