PowerCLI Reference

Set-VDSwitch

Synopsis

This cmdlet modifies the configuration of vSphere distributed switches.

Syntax

Set-VDSwitch [-VDSwitch] <VDSwitch[]> -BackupPath <String> [-RunAsync] [-Server <VIServer[]>] [-WithoutPortGroups] [-Confirm] [-WhatIf] [<CommonParameters>]

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

Set-VDSwitch [-VDSwitch] <VDSwitch[]> -RollBackConfiguration [-RunAsync] [-Server <VIServer[]>] [-Confirm] [-WhatIf] [<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 VMware 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, 5.1.0, 5.5.0, and 6.0.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 © VMware, Inc. All rights reserved.