PowerCLI Reference

Set-VDPortgroup

Synopsis

This cmdlet modifies the configuration of distributed port groups.

Syntax

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

Set-VDPortgroup [-VDPortgroup] <VDPortgroup[]> [-DisableVlan] [-Name <String>] [-Notes <String>] [-NumPorts <Int32>] [-PortBinding <DistributedPortGroupPortBinding>] [-PrivateVlanId <Int32>] [-RunAsync] [-Server <VIServer[]>] [-VlanId <Int32>] [-VlanTrunkRange <VlanRangeList>] [-Confirm] [-WhatIf] [<CommonParameters>]

Set-VDPortgroup [-VDPortgroup] <VDPortgroup[]> -RollbackConfiguration [-RunAsync] [-Server <VIServer[]>] [-Confirm] [-WhatIf] [<CommonParameters>]

Related Commands

Online Version
Get-VDPortgroup
New-VDPortgroup
Remove-VDPortgroup
Export-VDPortgroup

Detailed Description

This cmdlet modifies the configuration of distributed port groups. You can set the properties of the distributed port group manually, provide a backup profile to import the port group configuration, or rollback to the last valid configuration.


Note: You can import or rollback a configuration only on vSphere 5.1 and later.

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
VDPortgroupVDPortgroup[]Specifies the distributed port group 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-VDPortgroup cmdlet.


Note: This parameter is only supported 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
DisableVlanSwitchParameterSets the VLAN type of the distributed port group to None. This parameter is obsolete. Use the corresponding parameter from the Set-VDVlanConfiguration cmdlet instead.falseFalse
NameStringSpecifies a new name for the distributed port group that you want to configure.falseFalse
NotesStringSpecifies a new description for the distributed port group that you want to configure.falseFalse
NumPortsInt32Specifies a new number of ports on the distributed port group that you want to configure.falseFalse
PortBindingDistributedPortGroupPortBindingSpecifies a new port binding setting for the distributed port group that you want to configure. This parameter accepts Static, Dynamic, and Ephemeral values.


Note: Dynamic port binding is deprecated. For better performance, static port binding is recommended.
falseFalse
PrivateVlanIdInt32Specifies the secondary VLAN ID of a vSphere distributed switch's private VLAN configuration entry. This parameter is obsolete. Use the corresponding parameter from the Set-VDVlanConfiguration cmdlet instead.falseFalse
RollbackConfigurationSwitchParameterIndicates that you want to rollback the distributed port group to its last valid configuration.


Note: Rollback is available 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
VlanIdInt32Specifies a new VLAN ID for the distributed port group that you want to configure. The VLAN IDs of 0 and 4095 are reserved and cannot be used. This parameter is obsolete. Use the corresponding parameter from the Set-VDVlanConfiguration cmdlet instead.falseFalse
VlanTrunkRangeVlanRangeListSpecifies a new VLAN trunk range for the distributed port group that you want to configure. Valid values are strings representing ranges of IDs. For example, "1-4, 6, 8-9". This parameter is obsolete. Use the corresponding parameter from the Set-VDVlanConfiguration cmdlet instead.falseFalse
WhatIfSwitchParameterIndicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified.falseFalse

Return Type

The modified VDPortgroup objects

Notes

Examples

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

Get-VDPortgroup -Name "MyVDPortGroup" | Set-VDPortgroup -Name "MyNewVDPortGroupName" -NumPorts 5 -VlanId 4

Changes the name, number of ports and the VLAN ID of all distributed port groups named "MyVDPortGroup".

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

Get-VDPortgroup -Name "MyVDPortGroup" | Set-VDPortgroup -VlanTrunkRange "1-5, 8-10"

Changes the VLAN trunk range of all distributed port groups named "MyVDPortGroup".

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

$myVDPortgroup = Get-VDPortgroup -Name "MyVDPortGroup" -VDSwitch "MyVDSwitch"
Set-VDPortgroup -VDPortgroup $myVDPortgroup -DisableVlan

Sets the VLAN type of the specified distributed port group to None.

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

Get-VDPortgroup -Name "MyVDPortGroup" | Set-VDPortgroup -RollbackConfiguration

Rollbacks the configuration of all distributed port groups named "MyVDPortGroup".

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

Get-VDPortgroup -Name "MyVDPortGroup" | Set-VDPortgroup -BackupPath 'c:\backup.zip'

Reconfigures all distributed port groups named "MyVDPortGroup" by importing the configuration from the specified backup profile.


Copyright © VMware, Inc. All rights reserved.