New-VMSwitch

Creates a new virtual switch on one or more virtual machine hosts.

Syntax

NetAdapterName (Default)

New-VMSwitch
    [-Name] <String>
    -NetAdapterName <String[]>
    [-CimSession <CimSession[]>]
    [-ComputerName <String[]>]
    [-Credential <PSCredential[]>]
    [-AllowManagementOS <Boolean>]
    [-Notes <String>]
    [-MinimumBandwidthMode <VMSwitchBandwidthMode>]
    [-EnableIov <Boolean>]
    [-EnablePacketDirect <Boolean>]
    [-EnableEmbeddedTeaming <Boolean>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

NetAdapterInterfaceDescription

New-VMSwitch
    [-Name] <String>
    -NetAdapterInterfaceDescription <String[]>
    [-CimSession <CimSession[]>]
    [-ComputerName <String[]>]
    [-Credential <PSCredential[]>]
    [-AllowManagementOS <Boolean>]
    [-Notes <String>]
    [-MinimumBandwidthMode <VMSwitchBandwidthMode>]
    [-EnableIov <Boolean>]
    [-EnablePacketDirect <Boolean>]
    [-EnableEmbeddedTeaming <Boolean>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

SwitchType

New-VMSwitch
    [-Name] <String>
    -SwitchType <VMSwitchType>
    [-CimSession <CimSession[]>]
    [-ComputerName <String[]>]
    [-Credential <PSCredential[]>]
    [-Notes <String>]
    [-MinimumBandwidthMode <VMSwitchBandwidthMode>]
    [-EnableIov <Boolean>]
    [-EnablePacketDirect <Boolean>]
    [-EnableEmbeddedTeaming <Boolean>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The New-VMSwitch cmdlet creates a new virtual switch on one or more virtual machine hosts.

Examples

Example 1

PS C:\> New-VMSwitch "QoS Switch" -NetAdapterName "Wired Ethernet Connection 3" -MinimumBandwidthMode Weight

Creates a new switch QoS switch, which binds to a network adapter called Wired Ethernet Connection 3 and supports weight-based minimum bandwidth.

Parameters

-AllowManagementOS

Specifies whether the parent partition (i.e. the management operating system) is to have access to the physical NIC bound to the virtual switch to be created.

Parameter properties

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

Parameter sets

NetAdapterName
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
NetAdapterInterfaceDescription
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-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

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ComputerName

Specifies one or more Hyper-V hosts on which the virtual switch is to be created. 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

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-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

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-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

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-EnableEmbeddedTeaming

Specifies whether this cmdlet enables teaming for the virtual switch.

Parameter properties

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

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-EnableIov

Specifies that IO virtualization is to be enabled on the virtual switch to be created.

Parameter properties

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

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-EnablePacketDirect

Specifies whether this cmdlet enables the packet direct path through the virtual switch. The default value is $False.

Parameter properties

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

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MinimumBandwidthMode

Specifies how minimum bandwidth is to be configured on the virtual switch. Allowed values are Absolute, Default, None, or Weight. If Absolute is specified, minimum bandwidth is bits per second. If Weight is specified, minimum bandwidth is a value ranging from 1 to 100. If None is specified, minimum bandwidth is disabled on the switch - that is, users cannot configure it on any network adapter connected to the switch. If Default is specified, the system will set the mode to Weight, if the switch is not IOV-enabled, or None if the switch is IOV-enabled.

Parameter properties

Type:VMSwitchBandwidthMode
Default value:None
Accepted values:Default, Weight, Absolute, None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Name

Specifies the name of the switch to be created.

Parameter properties

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

Parameter sets

(All)
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-NetAdapterInterfaceDescription

Specifies the interface description of the network adapter to be bound to the switch to be created. You can use the Get-NetAdapter cmdlet to get the interface description of a network adapter.

Parameter properties

Type:

String[]

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

Parameter sets

NetAdapterInterfaceDescription
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-NetAdapterName

Specifies the name of the network adapter to be bound to the switch to be created. You can use the Get-NetAdapter cmdlet to get the interface description of a network adapter.

Parameter properties

Type:

String[]

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

Parameter sets

NetAdapterName
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Notes

Specifies a note to be associated with the switch to be created.

Parameter properties

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

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SwitchType

Specifies the type of the switch to be created. Allowed values are Internal and Private. To create an External virtual switch, specify either the NetAdapterInterfaceDescription or the NetAdapterName parameter, which implicitly set the type of the virtual switch to External.

Parameter properties

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

Parameter sets

SwitchType
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-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

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

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

Microsoft.HyperV.PowerShell.VMSwitch