## 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

Name | Type | Description | Required? | Pipeline Input | Default Value
--- | --- | --- | --- | --- | ---
VDSwitch | VDSwitch | Specifies the vSphere distributed switch on which you want to create the new distributed port group. | true | true (ByValue)
BackupPath | String | 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. | true | false
Confirm | SwitchParameter | If 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. | false | false
KeepIdentifiers | SwitchParameter | Indicates that the original vSphere distributed port group identifiers will be preserved. Note: This parameter is supported only on vSphere 5.1 and later. | false | false
Name | String | Specifies the name of the new distributed port group that you want to create. | true | false
Notes | String | Specifies a description for the new distributed port group that you want to create. | false | false
NumPorts | Int32 | 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. | false | false
PortBinding | DistributedPortGroupPortBinding | 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. | false | false
ReferencePortgroup | VDPortgroup | 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. | true | true (ByValue)
RunAsync | SwitchParameter | 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. | false | false
Server | VIServer[] | 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. | false | false
VlanId | Int32 | 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. | false | false
VlanTrunkRange | VlanRangeList | 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". | false | false
WhatIf | SwitchParameter | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. | false | false

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 © VMware, Inc. All rights reserved.