Add finished scripts for creating port groups

This commit is contained in:
2026-04-17 11:08:59 +02:00
parent f28b403e4b
commit ecf97ee93c
4 changed files with 134 additions and 26 deletions

View File

@@ -5,10 +5,9 @@ Required parameter:
Optional parameter:
-BaseVlanId Starting VLAN ID. Default is 100.
The script creates:
WAN-Linux = BaseVlanId
INT-Linux = BaseVlanId + 1
DMZ-Linux = BaseVlanId + 2
VPN-Linux = BaseVlanId + 3
WS2024-LX-WAN-Linux = BaseVlanId
WS2024-LX-INT-Linux = BaseVlanId + 1
WS2024-LX-DMZ-Linux = BaseVlanId + 2
Example:
.\Create-PortGroups.ps1 -SwitchName vSwitch0
@@ -18,7 +17,7 @@ param(
[Parameter(Mandatory = $true)]
[string]$SwitchName,
[ValidateRange(1, 4094)]
[ValidateRange(1, 4092)]
[int]$BaseVlanId = 100
)
@@ -27,10 +26,9 @@ $ErrorActionPreference = 'Stop'
$switch = Get-VirtualSwitch -Name $SwitchName -ErrorAction Stop
$portGroups = @(
@{ Name = 'WAN-Linux'; VlanId = $BaseVlanId },
@{ Name = 'INT-Linux'; VlanId = $BaseVlanId + 1 },
@{ Name = 'DMZ-Linux'; VlanId = $BaseVlanId + 2 },
@{ Name = 'VPN-Linux'; VlanId = $BaseVlanId + 3 }
@{ Name = 'WS2024-LX-WAN-Linux'; VlanId = $BaseVlanId },
@{ Name = 'WS2024-LX-INT-Linux'; VlanId = $BaseVlanId + 1 },
@{ Name = 'WS2024-LX-DMZ-Linux'; VlanId = $BaseVlanId + 2 }
)
foreach ($portGroup in $portGroups) {