New-VDSwitch Command | Vmware PowerCLI Reference

New-VDSwitch

This cmdlet creates vSphere distributed switches. You can create a new vSphere distributed switch with custom properties, specify a reference vSphere 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.

Syntax

New-VDSwitch
-Location < VIContainer >
-Name < String >
-ReferenceVDSwitch < VDSwitch >
[-ProgressAction < ActionPreference > ]
[-RunAsync ]
[-Server < VIServer[] > ]
[-WithoutPortGroups ]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
required
Location VIContainer named
  • wildcards
Specifies 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 vSphere distributed switch with its distributed port groups, you need to specify a location that does not contain identically named distributed port groups.
required
Name String named
Specifies a name for the new vSphere distributed switch that you want to create. You cannot specify this parameter, when the KeepIdentifiers parameter is specified.
required
ReferenceVDSwitch VDSwitch named
  • pipeline
  • wildcards
Specifies a reference vSphere distributed switch. The properties of the new vSphere distributed switch will be cloned from the reference vSphere distributed switch. Note: This parameter is supported only on vSphere 5.1 and later.
optional ProgressAction ActionPreference named
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 WithoutPortGroups SwitchParameter named
Indicates that the new vSphere distributed switch will be created without importing the port groups from the specified backup file or reference vSphere distributed switch.
New-VDSwitch
-Location < VIContainer >
-Name < String >
[-ContactDetails < String > ]
[-ContactName < String > ]
[-LinkDiscoveryProtocol < LinkDiscoveryProtocol > ]
[-LinkDiscoveryProtocolOperation < LinkDiscoveryOperation > ]
[-MaxPorts < Int32 > ]
[-Mtu < Int32 > ]
[-Notes < String > ]
[-NumUplinkPorts < Int32 > ]
[-ProgressAction < ActionPreference > ]
[-RunAsync ]
[-Server < VIServer[] > ]
[-Version < String > ]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
required
Location VIContainer named
  • wildcards
Specifies 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 vSphere distributed switch with its distributed port groups, you need to specify a location that does not contain identically named distributed port groups.
required
Name String named
Specifies a name for the new vSphere distributed switch that you want to create. You cannot specify this parameter, when the KeepIdentifiers parameter is specified.
optional ContactDetails String named
Specifies the contact details of the vSphere distributed switch administrator.
optional ContactName String named
Specifies the name of the vSphere distributed switch administrator.
optional LinkDiscoveryProtocol LinkDiscoveryProtocol named
Specifies the discovery protocol type of the vSphere 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.
optional LinkDiscoveryProtocolOperation LinkDiscoveryOperation named
Specifies the link discovery protocol operation for the vSphere 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.
optional MaxPorts Int32 named
Specifies the maximum number of ports allowed on the vSphere distributed switch that you want to create.
optional Mtu Int32 named
Specifies the maximum MTU size for the vSphere distributed switch that you want to create. Valid values are positive integers only.
optional Notes String named
Specifies a description for the vSphere distributed switch that you want to create.
optional NumUplinkPorts Int32 named
Specifies the number of uplink ports on the vSphere distributed switch that you want to create.
optional ProgressAction ActionPreference named
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 Version String named
Specifies the version of the vSphere distributed switch that you want to create. This parameter accepts 4.0, 4.1.0, 5.0.0, 5.1.0, 5.5.0, 6.0.0, and 6.5.0 values. You cannot specify a version that is incompatible with the version of the vCenter Server system you are connected to.
New-VDSwitch
-BackupPath < String >
-Location < VIContainer >
[-KeepIdentifiers ]
[-Name < String > ]
[-ProgressAction < ActionPreference > ]
[-RunAsync ]
[-Server < VIServer[] > ]
[-WithoutPortGroups ]
[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-VDSwitch cmdlet are supported. Note: This parameter is supported only on vSphere 5.1 and later.
required
Location VIContainer named
  • wildcards
Specifies 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 vSphere distributed switch with its distributed port groups, you need to specify a location that does not contain identically named distributed port groups.
optional KeepIdentifiers SwitchParameter named
Indicates 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.
optional Name String named
Specifies a name for the new vSphere distributed switch that you want to create. You cannot specify this parameter, when the KeepIdentifiers parameter is specified.
optional ProgressAction ActionPreference named
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 WithoutPortGroups SwitchParameter named
Indicates that the new vSphere distributed switch will be created without importing the port groups from the specified backup file or reference vSphere distributed switch.

Output

VMware.VimAutomation.Vds.Types.V1.VDSwitch

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 vSphere distributed switch named "MyReferenceSwitch". The new vSphere 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.

Related Commands

VDSwitch

This cmdlet exports the configuration of a specified vSphere distributed switch to a .zip file.

This cmdlet retrieves vSphere distributed switches.

This cmdlet creates vSphere distributed switches.

This cmdlet removes vSphere distributed switches.

This cmdlet modifies the configuration of vSphere distributed switches.

VDSwitchPhysicalNetworkAdapter

This cmdlet adds host physical network adapters to a vSphere distributed switch.

This cmdlet removes host physical network adapters from the vSphere distributed switches they are connected to.

VDSwitchPrivateVlan

This cmdlet retrieves the private VLAN configuration entries of a vSphere distributed switch.

This cmdlet creates private VLAN configuration entries on a vSphere distributed switch.

This cmdlet removes private VLAN configuration entries from vSphere distributed switches.

VDSwitchVMHost

This cmdlet adds hosts to the specified vSphere distributed switch.

This cmdlet removes hosts from the specified vSphere distributed switches.