Skip to content

Instantly share code, notes, and snippets.

@MrXermon
Created February 8, 2018 06:28
Show Gist options
  • Save MrXermon/25b75176ecce4af790caead29a642a1f to your computer and use it in GitHub Desktop.
Save MrXermon/25b75176ecce4af790caead29a642a1f to your computer and use it in GitHub Desktop.
Create multiple vlan interfaces and add tagged or untagged interfaces
param (
[Parameter(Mandatory=$true)][int]$From,
[Parameter(Mandatory=$true)][int]$To,
[string]$Description = "",
[string]$Tagged = "",
[string]$Untagged = ""
)
if($From -le $To){
for($i = $From; $i -le $To; $i++){
Write-Host "interface vlan" $i
if($Description.Length -ne ""){
Write-Host "description" $Description
}
if($Tagged.Length -ne ""){
Write-Host "tagged" $Tagged
}
if($Untagged.Length -ne ""){
Write-Host "untagged" $Untagged
}
Write-Host "exit"
}
}else{
Write-Warning "To is lower than From!"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment