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

Name | Type | Description | Required? | Pipeline Input | Default Value
--- | --- | --- | --- | --- | ---
VDSwitch | VDSwitch[] | Specifies the vSphere distributed switch that you want to configure. | true | true (ByValue)
BackupPath | String | Specifies 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. | 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
ContactDetails | String | Specifies new contact details of the vSphere distributed switch administrator. | false | false
ContactName | String | Specifies a new name for the vSphere distributed switch administrator. | false | false
LinkDiscoveryProtocol | LinkDiscoveryProtocol | Specifies the link discovery protocol for the vSphere distributed switch that you want to configure. This parameter accepts CDP and LLDP values. | false | false
LinkDiscoveryProtocolOperation | LinkDiscoveryOperation | Specifies the link discovery protocol operation for the vSphere distributed switch that you want to configure. This parameter accepts Advertise, Listen, Both, and Disabled values. | false | false
MaxPorts | Int32 | Specifies the maximum number of ports allowed on the vSphere distributed switch that you want to configure. | false | false
Mtu | Int32 | Specifies the maximum MTU size for the vSphere distributed switch that you want to configure. Valid values are positive integers only. | false | false
Name | String | Specifies a new name for the vSphere distributed switch that you want to configure. | false | false
Notes | String | Specifies a new description for the vSphere distributed switch that you want to configure. | false | false
NumUplinkPorts | Int32 | Specifies the number of uplink ports on the vSphere distributed switch that you want to configure. | false | false
RollBackConfiguration | SwitchParameter | Indicates 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. | true | false
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
Version | String | Specifies 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. | 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
WithoutPortGroups | SwitchParameter | Indicates that the specified backup configuration is imported without its port groups. Note: This parameter is supported only on vSphere 5.1 and later. | false | false

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.