This is the built-in help made by Microsoft for the command 'Set-NetworkSwitchPortMode', in PowerShell version 5 - as retrieved from
Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.
For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.
Sets the port mode on a network switch.
Set-NetworkSwitchPortMode [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable [<System.String>]] -AccessMode
-CimSession <CimSession> -VlanID <Int32> [<CommonParameters>]
Set-NetworkSwitchPortMode [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable [<System.String>]] -CimSession
<CimSession> -IpAddress <String> -RouteMode -SubnetAddress <String> [<CommonParameters>]
Set-NetworkSwitchPortMode [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable [<System.String>]] -CimSession
<CimSession> -TrunkMode -VlanIDs <UInt16[]> [<CommonParameters>]
The Set-NetworkSwitchPortMode cmdlet sets the port mode to access, trunk or route on a network switch.
<
<
Example 1: Set a port to trunk mode
PS C:\>$Session = New-CimSession -ComputerName "NetworkSwitch08"
PS C:\> Set-NetworkSwitchPortMode -CimSession $Session -TrunkMode -VlanIDs 2,17,22
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.
Example 2: Set a port to route mode
PS C:\>Set-NetworkSwitchPortMode -CimSession $Session -IpAddress "10.14.1.1" -RouteMode -SubnetAddress "255.255.0.0"
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.