New-VMSwitch

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

Syntax

New-VMSwitch
   [-CimSession <CimSession[]>]
   [-ComputerName <String[]>]
   [-Credential <PSCredential[]>]
   [-Name] <String>
   [-AllowManagementOS <Boolean>]
   -NetAdapterName <String[]>
   [-Notes <String>]
   [-MinimumBandwidthMode <VMSwitchBandwidthMode>]
   [-EnableIov <Boolean>]
   [-EnablePacketDirect <Boolean>]
   [-EnableEmbeddedTeaming <Boolean>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-VMSwitch
   [-CimSession <CimSession[]>]
   [-ComputerName <String[]>]
   [-Credential <PSCredential[]>]
   [-Name] <String>
   [-AllowManagementOS <Boolean>]
   -NetAdapterInterfaceDescription <String[]>
   [-Notes <String>]
   [-MinimumBandwidthMode <VMSwitchBandwidthMode>]
   [-EnableIov <Boolean>]
   [-EnablePacketDirect <Boolean>]
   [-EnableEmbeddedTeaming <Boolean>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-VMSwitch
   [-CimSession <CimSession[]>]
   [-ComputerName <String[]>]
   [-Credential <PSCredential[]>]
   [-Name] <String>
   -SwitchType <VMSwitchType>
   [-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.

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters: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.

Type:CimSession[]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters: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.

Type:String[]
Aliases:PSComputerName
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Credential

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

Type:PSCredential[]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-EnableEmbeddedTeaming

Specifies whether this cmdlet enables teaming for the virtual switch.

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-EnableIov

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

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-EnablePacketDirect

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

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters: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.

Type:VMSwitchBandwidthMode
Accepted values:Default, Weight, Absolute, None
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Name

Specifies the name of the switch to be created.

Type:String
Aliases:SwitchName
Position:0
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters: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.

Type:String[]
Aliases:InterfaceDescription
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters: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.

Type:String[]
Aliases:InterfaceAlias
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Notes

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

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters: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.

Type:VMSwitchType
Accepted values:Internal, Private
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

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

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Outputs

Microsoft.HyperV.PowerShell.VMSwitch