vSphere PowerCLI Reference

New-VDPortgroup

Synopsis

This cmdlet creates distributed port groups.

Syntax

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

Related Commands

Online version
Get-VDPortgroup
Set-VDPortgroup
Remove-VDPortgroup
Export-VDPortgroup

Detailed Description

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.

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
VDSwitchVDSwitchSpecifies the vSphere distributed switch on which you want to create the new distributed port group.truetrue (ByValue)
BackupPathStringSpecifies 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.
truefalse
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
KeepIdentifiersSwitchParameterIndicates that the original vSphere distributed port group identifiers will be preserved.

Note: This parameter is supported only on vSphere 5.1 and later.
falsefalse
NameStringSpecifies the name of the new distributed port group that you want to create.truefalse
NotesStringSpecifies a description for the new distributed port group that you want to create.falsefalse
NumPortsInt32Specifies 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.falsefalse
PortBindingDistributedPortGroupPortBindingSpecifies 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.
falsefalseStatic
ReferencePortgroupVDPortgroupSpecifies 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.
truetrue (ByValue)
RunAsyncSwitchParameterIndicates 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 vSphere PowerCLI console.falsefalse
ServerVIServer[]Specifies the vCenter Server systems 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
VlanIdInt32Specifies the VLAN ID of the distributed port group that you want to create. Valid values are integers in the range of 1 to 4094.falsefalse
VlanTrunkRangeVlanRangeListSpecifies 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".falsefalse
WhatIfSwitchParameterIndicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified.falsefalse

Return Type

The newly created VDPortgroup object

Notes

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.


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