Cmdlets

Choose a cmdlet from the list on the left or search for a specific cmdlet. Choose a cmdlet from the list or search for a specific cmdlet.
About Help  Providers
 

Set-NetworkSwitchPortMode

Set-NetworkSwitchPortMode

networkswitchglobalsettingdata.psm1, networkswitchvlan.psm1, networkswitchethernetport.psm1, networkswitchfeature.psm1, networkswitchconfiguration.psm1

Synopsis

Sets the port mode on a network switch.

Syntax

Set-NetworkSwitchPortMode [-InformationAction] [-InformationVariable] [-AccessMode] [-CimSession] [-VlanID] [<CommonParameters>]

Set-NetworkSwitchPortMode [-InformationAction] [-InformationVariable] [-CimSession] [-IpAddress] [-RouteMode] [-SubnetAddress] [<CommonParameters>]

Set-NetworkSwitchPortMode [-InformationAction] [-InformationVariable] [-CimSession] [-TrunkMode] [-VlanIDs] [<CommonParameters>]

Detailed Description

The Set-NetworkSwitchPortMode cmdlet sets the port mode to access, trunk or route on a network switch.

Parameters

-AccessMode <SwitchParameter>

Indicates that this cmdlet sets the port to access mode.

Aliases

none

Required?

true

Position

named

Default value

none

Accept pipeline input?

false

Accept wildcard characters?

false

-CimSession <CimSession>

Specifies the CimSession that this cmdlet uses to connect to the network switch. For more information about CimSession objects, type Get-Help New-CimSession.

Aliases

none

Required?

true

Position

named

Default value

none

Accept pipeline input?

false

Accept wildcard characters?

false

-InformationAction <System.Management.Automation.ActionPreference>

Specifies how this cmdlet responds to an information event. The acceptable values for this parameter are: -- SilentlyContinue -- Stop -- Continue -- Inquire -- Ignore -- Suspend

Aliases

infa

Required?

false

Position

named

Default value

none

Accept pipeline input?

false

Accept wildcard characters?

false

-InformationVariable <System.String>

Specifies a variable in which to store an information event message.

Aliases

iv

Required?

false

Position

named

Default value

none

Accept pipeline input?

false

Accept wildcard characters?

false

-IpAddress <String>

Specifies an IP address to set for the port in route mode.

Aliases

none

Required?

true

Position

named

Default value

none

Accept pipeline input?

false

Accept wildcard characters?

false

-RouteMode <SwitchParameter>

Indicates that this cmdlet sets the port to route mode.

Aliases

none

Required?

true

Position

named

Default value

none

Accept pipeline input?

false

Accept wildcard characters?

false

-SubnetAddress <String>

Specifies the subnet mask to set for the port in route mode.

Aliases

none

Required?

true

Position

named

Default value

none

Accept pipeline input?

false

Accept wildcard characters?

false

-TrunkMode <SwitchParameter>

Indicates that this cmdlet sets the port to trunk mode.

Aliases

none

Required?

true

Position

named

Default value

none

Accept pipeline input?

false

Accept wildcard characters?

false

-VlanID <Int32>

Specifies the virtual local area network (VLAN) ID of the VLAN to set for the port in access mode.

Aliases

none

Required?

true

Position

named

Default value

none

Accept pipeline input?

false

Accept wildcard characters?

false

-VlanIDs <UInt16[]>

Specifies the VLAN IDs of the VLANs to set for the port in trunk mode.

Aliases

none

Required?

true

Position

named

Default value

none

Accept pipeline input?

false

Accept wildcard characters?

false

Input Type

CimInstance[]

Return Type

None

Notes

None

Examples

Example 1: Set a port to trunk mode

The first command creates a CimSession for a network switch, and then stores it in the $Session variable. For more information about CimSession objects, type Get-Help New-CimSession.

The second command sets NetworkSwitch08 to use trunk mode by using the $Session object. The command specifies IDs for three VLANs.

PS C:\>$Session = New-CimSession -ComputerName "NetworkSwitch08"
PS C:\> Set-NetworkSwitchPortMode -CimSession $Session -TrunkMode -VlanIDs 2,17,22 

Example 2: Set a port to route mode

This command sets the port to route mode. The command specifies its IP address and the subnet mask. The command includes a CimSession, similar to the first example.

PS C:\>Set-NetworkSwitchPortMode -CimSession $Session -IpAddress "10.14.1.1" -RouteMode -SubnetAddress "255.255.0.0"

Get-NetworkSwitchEthernetPort