New-NetworkSwitchVlan

Creates a VLAN for a network switch.

Syntax

New-NetworkSwitchVlan
   [-CimSession] <CimSession>
   [[-Caption] <String>]
   [[-Description] <String>]
   [-VlanID] <Int32>
   [-Name] <String>
   [<CommonParameters>]

Description

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

Examples

Example 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.

Parameters

-Caption

Specifies a caption for the new VLAN.

Type:String
Position:1
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-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.

Type:CimSession
Position:0
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Description

Specifies a description of the new VLAN.

Type:String
Position:2
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Name

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

Type:String
Position:4
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-VlanID

Specifies a VLAN ID for the new VLAN.

Type:Int32
Position:3
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None

Outputs

Object