Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

Set-VMSwitch

Module:
Hyper-V Module

Configures a virtual switch.

Syntax

SwitchName_SwitchType (Default)

Set-VMSwitch
 [-Name] <String[]>
 [-CimSession <CimSession[]>]
 [-ComputerName <String[]>]
 [-Credential <PSCredential[]>]
 [-SwitchType <VMSwitchType>]
 [-AllowManagementOS <Boolean>]
 [-DefaultFlowMinimumBandwidthAbsolute <Int64>]
 [-DefaultFlowMinimumBandwidthWeight <Int64>]
 [-DefaultQueueVrssEnabled <Boolean>]
 [-DefaultQueueVmmqEnabled <Boolean>]
 [-DefaultQueueVmmqQueuePairs <UInt32>]
 [-Extensions <VMSwitchExtension[]>]
 [-Notes <String>]
 [-Passthru]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

SwitchObject_SwitchType

Set-VMSwitch
 [-VMSwitch] <VMSwitch[]>
 [-CimSession <CimSession[]>]
 [-ComputerName <String[]>]
 [-Credential <PSCredential[]>]
 [-SwitchType <VMSwitchType>]
 [-AllowManagementOS <Boolean>]
 [-DefaultFlowMinimumBandwidthAbsolute <Int64>]
 [-DefaultFlowMinimumBandwidthWeight <Int64>]
 [-DefaultQueueVrssEnabled <Boolean>]
 [-DefaultQueueVmmqEnabled <Boolean>]
 [-DefaultQueueVmmqQueuePairs <UInt32>]
 [-Extensions <VMSwitchExtension[]>]
 [-Notes <String>]
 [-Passthru]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

SwitchName_NetAdapterInterfaceDescription

Set-VMSwitch
 [-Name] <String[]>
 [-NetAdapterInterfaceDescription] <String>
 [-CimSession <CimSession[]>]
 [-ComputerName <String[]>]
 [-Credential <PSCredential[]>]
 [-AllowManagementOS <Boolean>]
 [-DefaultFlowMinimumBandwidthAbsolute <Int64>]
 [-DefaultFlowMinimumBandwidthWeight <Int64>]
 [-DefaultQueueVrssEnabled <Boolean>]
 [-DefaultQueueVmmqEnabled <Boolean>]
 [-DefaultQueueVmmqQueuePairs <UInt32>]
 [-Extensions <VMSwitchExtension[]>]
 [-Notes <String>]
 [-Passthru]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

SwitchName_NetAdapterName

Set-VMSwitch
 [-Name] <String[]>
 [-NetAdapterName] <String>
 [-CimSession <CimSession[]>]
 [-ComputerName <String[]>]
 [-Credential <PSCredential[]>]
 [-AllowManagementOS <Boolean>]
 [-DefaultFlowMinimumBandwidthAbsolute <Int64>]
 [-DefaultFlowMinimumBandwidthWeight <Int64>]
 [-DefaultQueueVrssEnabled <Boolean>]
 [-DefaultQueueVmmqEnabled <Boolean>]
 [-DefaultQueueVmmqQueuePairs <UInt32>]
 [-Extensions <VMSwitchExtension[]>]
 [-Notes <String>]
 [-Passthru]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

SwitchObject_NetAdapterInterfaceDescription

Set-VMSwitch
 [-VMSwitch] <VMSwitch[]>
 [-NetAdapterInterfaceDescription] <String>
 [-CimSession <CimSession[]>]
 [-ComputerName <String[]>]
 [-Credential <PSCredential[]>]
 [-AllowManagementOS <Boolean>]
 [-DefaultFlowMinimumBandwidthAbsolute <Int64>]
 [-DefaultFlowMinimumBandwidthWeight <Int64>]
 [-DefaultQueueVrssEnabled <Boolean>]
 [-DefaultQueueVmmqEnabled <Boolean>]
 [-DefaultQueueVmmqQueuePairs <UInt32>]
 [-Extensions <VMSwitchExtension[]>]
 [-Notes <String>]
 [-Passthru]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

SwitchObject_NetAdapterName

Set-VMSwitch
 [-VMSwitch] <VMSwitch[]>
 [-NetAdapterName] <String>
 [-CimSession <CimSession[]>]
 [-ComputerName <String[]>]
 [-Credential <PSCredential[]>]
 [-AllowManagementOS <Boolean>]
 [-DefaultFlowMinimumBandwidthAbsolute <Int64>]
 [-DefaultFlowMinimumBandwidthWeight <Int64>]
 [-DefaultQueueVrssEnabled <Boolean>]
 [-DefaultQueueVmmqEnabled <Boolean>]
 [-DefaultQueueVmmqQueuePairs <UInt32>]
 [-Extensions <VMSwitchExtension[]>]
 [-Notes <String>]
 [-Passthru]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

Description

The Set-VMSwitch cmdlet configures a virtual switch.

Examples

Example 1

PS C:\> Set-VMSwitch WA -SwitchType Internal

This example converts a virtual switch named WA to an Internal switch.

Example 2

PS C:\> Set-VMSwitch VMNetwork -NetAdapterName "Ethernet 2"

This example attaches a virtual switch named VMNetwork to a physical ethernet adapter named Ethernet 2. This will also implicitly convert the VMNetwork switch to an external switch.

Example 3

PS C:\> Set-VMSwitch CA -DefaultFlowMinimumBandwidthAbsolute 500000000

This example sets the minimum bandwidth allocation to 500Mbps on a virtual switch named CA for all virtual machines without explicit minimum bandwidth configuration.

Parameters

-AllowManagementOS

Specifies whether the management operating system can use the physical network adapter that is bound to the virtual switch. Setting AllowManagementOS to $true creates management operating system virtual network adapters (VMNetworkAdapters) in the parent partition and connects it to the virtual switch. Setting AllowManagementOS to $false removes any VMNetworkAdapters connected to the virtual switch.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-CimSession

Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet. The default is the current session on the local computer.

Parameter properties

Type:

CimSession[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-ComputerName

Specifies one or more Hyper-V hosts on which the virtual switch is to be configured. NetBIOS names, IP addresses, and fully qualified domain names are allowable. The default is the local computer. Use localhost or a dot (.) to specify the local computer explicitly.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False
Aliases:PSComputerName

Parameter sets

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

-Credential

Specifies one or more user accounts that have permission to perform this action. The default is the current user.

Parameter properties

Type:

PSCredential[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-DefaultFlowMinimumBandwidthAbsolute

Specifies the minimum bandwidth, in bits per second, that is allocated to a special category called "default flow." Any traffic sent by a virtual network adapter that is connected to this virtual switch and does not have minimum bandwidth allocated is filtered into this category. Specify a value for this parameter only if the minimum bandwidth mode on this virtual switch is absolute (See the New-VMSwitch cmdlet). By default, the virtual switch allocates 10% of the total bandwidth, which depends on the physical network adapter it binds to, to this category. For example, if a virtual switch binds to a 1 GbE network adapter, this special category can use at least 100 Mbps. If the value is not a multiple of 8, the value is rounded down to the nearest number that is a multiple of 8. For example, a value input as 1234567 is converted to 1234560.

Parameter properties

Type:Int64
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-DefaultFlowMinimumBandwidthWeight

Specifies the minimum bandwidth, in relative weight, that is allocated to a special category called "default flow". Any traffic sent by a virtual network adapter that is connected to this virtual switch and doesn't have minimum bandwidth allocated is filtered into this category. Specify a value for this parameter only if the minimum bandwidth mode on this virtual switch is weight (See the New-VMSwitch cmdlet). By default, this special category has a weight of 1.

Parameter properties

Type:Int64
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-DefaultQueueVmmqEnabled

The Set-VMSwitch cmdlet configures a virtual switch.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-DefaultQueueVmmqQueuePairs

The Set-VMSwitch cmdlet configures a virtual switch.

Parameter properties

Type:UInt32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-DefaultQueueVrssEnabled

The Set-VMSwitch cmdlet configures a virtual switch.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-Extensions

Specifies an ordered list of network extensions used to reorder the bindings on the virtual switch.

Parameter properties

Type:

VMSwitchExtension[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-Name

Specifies the name of the virtual switch to be configured.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False
Aliases:SwitchName

Parameter sets

-NetAdapterInterfaceDescription

Specifies the interface description of the physical network adapter to which an external virtual switch should be bound. If you specify this parameter to convert a virtual switch, the external virtual switch is configured to allow the management operating system to share access to the physical network adapter. To override this behavior, include AllowManagementOs $false in the command

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-NetAdapterName

Specifies the name of the physical network adapter to which an external virtual switch should be bound. If you specify this parameter to convert a virtual switch, the external virtual switch is configured to allow the management operating system to share access to the physical network adapter. To override this behavior, include AllowManagementOs $false in the command

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:InterfaceAlias

Parameter sets

-Notes

Specifies notes to be associated with the virtual switch.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-Passthru

Specifies that a Microsoft.HyperV.PowerShell.EthernetSwitch object is to be passed through to the pipeline representing the virtual switch to be configured.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-SwitchType

Converts a virtual switch from one type to another. Allowed values are Internal or Private. You can convert an internal or private virtual switch to an external virtual switch, by including either the NetAdapterInterfaceDescription or NetAdapterName parameter in the command. If you do this, the external virtual switch is configured to allow the management operating system to share access to the physical network adapter. To override this behavior, include AllowManagementOs $false in the command.

Parameter properties

Type:VMSwitchType
Default value:None
Accepted values:Private, Internal, External
Supports wildcards:False
DontShow:False

Parameter sets

-VMSwitch

Specifies the virtual switch to be configured.

Parameter properties

Type:

VMSwitch[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Outputs

None

Default

Microsoft.HyperV.PowerShell.EthernetSwitch

If -PassThru is specified.


Feedback

Was this page helpful?