vSphere PowerCLI Reference

New-VDSwitch

Synopsis

This cmdlet creates vSphere distributed switches.

Syntax

New-VDSwitch [-ContactDetails <String>] [-ContactName <String>] [-LinkDiscoveryProtocol <LinkDiscoveryProtocol>] [-LinkDiscoveryProtocolOperation <LinkDiscoveryOperation>] [-MaxPorts <Int32>] [-Mtu <Int32>] [-Notes <String>] [-NumUplinkPorts <Int32>] [-Version <String>] -Name <String> -Location <VIContainer> [-RunAsync] [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
New-VDSwitch -ReferenceVDSwitch <VDSwitch> -Name <String> -Location <VIContainer> [-WithoutPortGroups] [-RunAsync] [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
New-VDSwitch -BackupPath <String> [-KeepIdentifiers] [-Name <String>] -Location <VIContainer> [-WithoutPortGroups] [-RunAsync] [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]

Related Commands

Online version
Get-VDSwitch
Remove-VDSwitch
Set-VDSwitch
Export-VDSwitch

Detailed Description

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

Note: Creating vSphere distributed switches from a reference switch or a backup profile requires vCenter Server 5.1 or later.

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
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-VDSwitch 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
ContactDetailsStringSpecifies the contact details of the vSphere distributed switch administrator.falsefalse
ContactNameStringSpecifies the name of the vSphere distributed switch administrator.falsefalse
KeepIdentifiersSwitchParameterIndicates that the original vSphere distributed switch and port group identifiers will be preserved. You cannot specify this parameter, when the Name parameter is specified.

Note: This parameter is supported only on vSphere 5.1 and later.
falsefalse
LinkDiscoveryProtocolLinkDiscoveryProtocolSpecifies the discovery protocol type of the distributed switch that you want to create. This parameter accepts CDP and LLDP values. If you do not set a value for this parameter, the default server setting is used.falsefalse
LinkDiscoveryProtocolOperationLinkDiscoveryOperationSpecifies the link discovery protocol operation for the distributed switch that you want to create. This parameter accepts Advertise, Listen, Both, and Disabled values. If you do not set a value for this parameter, the default server setting is used.falsefalse
LocationVIContainerSpecifies the location where you want to create the vSphere distributed switch. This parameter accepts Datacenter and Folder objects.

Note: You cannot create distributed port groups with identical names in the same location. If you want to import or clone a distributed switch with its distributed port groups, you need to specify a location that does not contain identically named distributed port groups.
truefalse
MaxPortsInt32Specifies the maximum number of ports allowed on the vSphere distributed switch that you want to create.falsefalse
MtuInt32Specifies the maximum MTU size for the vSphere distributed switch that you want to create. Valid values are positive integers only.falsefalse
NameStringSpecifies a name for the new vSphere distributed switch that you want to create. You cannot specify this parameter, when the KeepIdentifiers parameter is specified.truefalse
NotesStringSpecifies a description for the vSphere distributed switch that you want to create.falsefalse
NumUplinkPortsInt32Specifies the number of uplink ports on the vSphere distributed switch that you want to create.falsefalse
ReferenceVDSwitchVDSwitchSpecifies a reference vSphere distributed switch. The properties of the new distributed switch will be cloned from the reference distributed switch.

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
VersionStringSpecifies the version of the vSphere distributed switch that you want to create. This parameter accepts 4.0, 4.1.0, 5.0.0, and 5.1.0 values. You cannot specify a version that is incompatible with the version of the vCenter Server system you are connected to.falsefalse
WhatIfSwitchParameterIndicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified.falsefalse
WithoutPortGroupsSwitchParameterIndicates that the new distributed switch will be created without importing the port groups from the specified backup file or reference distributed switch.falsefalse

Return Type

The newly created VDSwitch object

Notes

Examples

-------------- Example 1 --------------

$myDatacenter = Get-Datacenter -Name "MyDatacenter"
New-VDSwitch -Name "MyVDSwitch" -Location $myDatacenter -LinkDiscoveryProtocol "LLDP" -LinkDiscoveryProtocolOperation "Listen" -MaxPorts 256 -Version "5.0.0"

Creates a new vSphere distributed switch with the specified name, version, maximum number of ports, and link discovery protocol settings in the specified datacenter.

-------------- Example 2 --------------

$myFolder = Get-Folder -Name "MyFolder"
Get-VDSwitch -Name "MyReferenceSwitch" | New-VDSwitch -Name "MyVDSwitch" -Location $myFolder -WithoutPortGroups

Creates a new vSphere distributed switch by cloning the configuration of the existing distributed switch named "MyReferenceSwitch". The new distributed switch is created without cloning the existing port groups and is stored in the specified folder.

-------------- Example 3 --------------

$myFolder = Get-Folder -Name "MyFolder"
New-VDSwitch -Name "MyVDSwitch" -Location $myFolder -WithoutPortGroups -BackupPath "c:\MyDistributedSwitchProfile.zip"

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


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