Skip to content

Instantly share code, notes, and snippets.

@SweetAsNZ
Created May 22, 2025 20:55
Show Gist options
  • Save SweetAsNZ/687f1207bf8b5bdd15393a1947404e7f to your computer and use it in GitHub Desktop.
Save SweetAsNZ/687f1207bf8b5bdd15393a1947404e7f to your computer and use it in GitHub Desktop.
Get Windows Computer VLAN with PowerShell
function Get-VLAN {
Write-Host -f Green "For a Physcial Box:"
Get-NetAdapter | Select-Object Name,VlanID
Write-Host -f Green "For a VMware VM:"
Get-VM -Name $ENV:COMPUTERNAME | Get-VirtualPortGroup #| Select Name, VLanId
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment