Set-VDSwitch
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.
Syntax
Parameters
Required | Parameter Name | Type | Position | Features | Description |
---|---|---|---|---|---|
required
|
VDSwitch | VDSwitch[] | 1 |
|
Specifies the vSphere distributed switch that you want to configure. |
optional | ContactDetails | String | named |
|
Specifies new contact details of the vSphere distributed switch administrator. |
optional | ContactName | String | named |
|
Specifies a new name for the vSphere distributed switch administrator. |
optional | LinkDiscoveryProtocol | LinkDiscoveryProtocol | named |
|
Specifies the link discovery protocol for the vSphere distributed switch that you want to configure. This parameter accepts CDP and LLDP values. |
optional | LinkDiscoveryProtocolOperation | LinkDiscoveryOperation | named |
|
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. |
optional | MaxPorts | Int32 | named |
|
Specifies the maximum number of ports allowed on the vSphere distributed switch that you want to configure. |
optional | Mtu | Int32 | named |
|
Specifies the maximum MTU size for the vSphere distributed switch that you want to configure. Valid values are positive integers only. |
optional | Name | String | named |
|
Specifies a new name for the vSphere distributed switch that you want to configure. |
optional | Notes | String | named |
|
Specifies a new description for the vSphere distributed switch that you want to configure. |
optional | NumUplinkPorts | Int32 | named |
|
Specifies the number of uplink ports on the vSphere distributed switch that you want to configure. |
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 |
|
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 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. |
Parameters
Required | Parameter Name | Type | Position | Features | Description |
---|---|---|---|---|---|
required
|
VDSwitch | VDSwitch[] | 1 |
|
Specifies the vSphere distributed switch that you want to configure. |
required
|
BackupPath | String | named |
|
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. |
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 |
|
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 specified backup configuration is imported without its port groups. Note: This parameter is supported only on vSphere 5.1 and later. |
Parameters
Required | Parameter Name | Type | Position | Features | Description |
---|---|---|---|---|---|
required
|
VDSwitch | VDSwitch[] | 1 |
|
Specifies the vSphere distributed switch that you want to configure. |
required
|
RollBackConfiguration | SwitchParameter | named |
|
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. |
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 |
|
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. |
Output
VMware.VimAutomation.Vds.Types.V1.VDSwitchExamples
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.
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.