New-NetworkSwitchVlan

Creates a VLAN for a network switch.
New-NetworkSwitchVlan [-CimSession*] <CimSession> [[-Caption] [<String>]] [[-Description] [<String>]] [-VlanID*]<Int32> [-Name*] <String> [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}][-InformationVariable [<System.String>]] [<CommonParameters>]

The New-NetworkSwitchVlan cmdlet creates a virtual local area network (VLAN) for a network switch.

Parameters
-Caption [<String>]

Specifies a caption for the new VLAN.

-CimSession <CimSession>

  • This value is required

Specifies the CimSession that this cmdlet uses to connect to the network switch.

-Description [<String>]

Specifies a description of the new VLAN.

-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

-InformationVariable [<System.String>]

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

-Name <String>

  • This value is required

Specifies a name to use as the VLAN ElementName. This is a friendly name.

-VlanID <Int32>

  • This value is required

Specifies a VLAN ID for the new VLAN.

<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,ErrorAction, ErrorVariable, WarningAction, WarningVariable,OutBuffer, PipelineVariable, and OutVariable.

Inputs

None

Outputs

None

This cmdlet does not generate any output.

Examples
  1. Create a VLAN:
    PS C:> $Session = New-CimSession -ComputerName "NetworkSwitch08"
    PS C:>  New-NetworkSwitchVlan -Name "Contoso07VLAN" -Caption "VLAN 07" -CimSession $Session
    Caption             Description         ElementName         InstanceID                       VlanID PSComputerName
    
       -------             -----------         -----------         ----------                       ------ -------------- 
       VLAN 07                                 VLAN0004            Contoso:NetworkVL...                  4 10.19.26.4

    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 creates a VLAN for the switch NetworkSwitch08 by using the $Session object.

Related Links

Disable-NetworkSwitchVlan
Enable-NetworkSwitchVlan
Get-NetworkSwitchVlan
Remove-NetworkSwitchVlan
Set-NetworkSwitchVlanProperty