vSphere PowerCLI Reference

Set-VDSwitch

Synopsis

This cmdlet modifies the configuration of vSphere distributed switches.

Syntax

Set-VDSwitch [-Name <String>] [-ContactDetails <String>] [-ContactName <String>] [-LinkDiscoveryProtocol <LinkDiscoveryProtocol>] [-LinkDiscoveryProtocolOperation <LinkDiscoveryOperation>] [-MaxPorts <Int32>] [-Mtu <Int32>] [-Notes <String>] [-NumUplinkPorts <Int32>] [-Version <String>] [-VDSwitch] <VDSwitch[]> [-RunAsync] [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
Set-VDSwitch -BackupPath <String> [-WithoutPortGroups] [-VDSwitch] <VDSwitch[]> [-RunAsync] [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
Set-VDSwitch -RollBackConfiguration [-VDSwitch] <VDSwitch[]> [-RunAsync] [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]

Related Commands

Online version
New-VDSwitch
Export-VDSwitch
Get-VDSwitch
Remove-VDSwitch

Detailed Description

This cmdlet modifies the configuration of vSphere distributed switches. You can set the properties of the vSphere distributed switch manually, rollback the configuration to its previous state, or import it from a backup profile.

Note: Rollback and importing are available only on vSphere 5.1 and later.

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
VDSwitchVDSwitch[]Specifies the vSphere distributed switch that you want to configure.truetrue (ByValue)
BackupPathStringSpecifies the full file path to the .zip file containing the backup configuration that you want to import. You can import only .zip files created with the Export-VDSwitch cmdlet.

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 new contact details of the vSphere distributed switch administrator.falsefalse
ContactNameStringSpecifies a new name for the vSphere distributed switch administrator.falsefalse
LinkDiscoveryProtocolLinkDiscoveryProtocolSpecifies the link discovery protocol for the vSphere distributed switch that you want to configure. This parameter accepts CDP and LLDP values.falsefalse
LinkDiscoveryProtocolOperationLinkDiscoveryOperationSpecifies the link discovery protocol operation for the vSphere distributed switch that you want to configure. This parameter accepts Advertise, Listen, Both, and Disabled values.falsefalse
MaxPortsInt32Specifies the maximum number of ports allowed on the vSphere distributed switch that you want to configure.falsefalse
MtuInt32Specifies the maximum MTU size for the vSphere distributed switch that you want to configure. Valid values are positive integers only.falsefalse
NameStringSpecifies a new name for the vSphere distributed switch that you want to configure.falsefalse
NotesStringSpecifies a new description for the vSphere distributed switch that you want to configure.falsefalse
NumUplinkPortsInt32Specifies the number of uplink ports on the vSphere distributed switch that you want to configure.falsefalse
RollBackConfigurationSwitchParameterIndicates that you want to rollback the configuration of the vSphere distributed switch to an earlier state.

Note: This parameter is supported only on vSphere 5.1 and later.
truefalse
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 a new version for the vSphere distributed switch that you want to configure. 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 specified backup configuration is imported without its port groups.

Note: This parameter is supported only on vSphere 5.1 and later.
falsefalse

Return Type

The modified VDSwitch objects

Notes

Examples

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

Get-VDSwitch -Name "MyVDSwitch" | Set-VDSwitch -MaxPorts 1000 -NumUplinkPorts 8 -Mtu 2000

Modifies the maximum number of ports, the number of uplink ports, and the maximum MTU size of the specified vSphere distributed switch.

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

$myVDSwitches = Get-VDSwitch -Name MyVDSwitch*
Set-VDSwitch -VDSwitch $myVDSwitches -Version '5.1.0'

Changes the version of all vSphere distributed switches whose names start with "MyVDSwitch".

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

$myVDSwitch = Get-VDSwitch -Name "MyVDSwitch"
Set-VDSwitch -VDSwitch $myVDSwitch -LinkDiscoveryProtocol LLDP -LinkDiscoveryProtocolOperation Listen

Enables link discovery protocol on the specified vSphere distributed switch, sets it to LLDP and changes the link discovery protocol operation to listen.

-------------- Example 4 --------------

Get-VDSwitch -Name "MyVDSwitch" | Set-VDSwitch -BackupPath 'c:\MyVDSwitchBackups\MyVDSwitch_12_12_2012.zip' -WithoutPortGroups

Reconfigures the specified vSphere distributed switch by importing the specified backup profile. The original port groups are not recreated.

-------------- Example 5 --------------

Get-VDSwitch -Name "MyVDSwitch" | Set-VDSwitch -RollbackConfiguration

Rollbacks the configuration of the specified vSphere distributed switch to its previous state.


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