Skip to content

Instantly share code, notes, and snippets.

@TalalMash
Last active July 29, 2025 05:59
Show Gist options
  • Save TalalMash/f810b0d61b8a06d102a477e303198d8c to your computer and use it in GitHub Desktop.
Save TalalMash/f810b0d61b8a06d102a477e303198d8c to your computer and use it in GitHub Desktop.
Interactive Windows IPv6 Neighbour Scan (powershell)
param (
[int]$InterfaceIndex
)
$interfaces = Get-NetIPInterface -AddressFamily IPv6
if (-not $InterfaceIndex) {
Write-Host ""
Write-Host "Available IPv6 Interfaces:"
$interfaces | Sort-Object ifIndex | Format-Table -AutoSize ifIndex, InterfaceAlias
$InterfaceIndex = Read-Host "Enter the Interface Index to scan"
}
$selected = $interfaces | Where-Object { $_.ifIndex -eq $InterfaceIndex }
if (-not $selected) {
Write-Host ""
Write-Host "Invalid interface index."
exit 1
}
Write-Host ""
Write-Host "Scanning IPv6 neighbors on: $($selected.InterfaceAlias) (Index: $InterfaceIndex)"
ping -n 1 ("ff02::1%" + $InterfaceIndex) | Out-Null
$neighbors = Get-NetNeighbor -InterfaceIndex $InterfaceIndex |
Where-Object { $_.State -in @("Reachable", "Permanent", "Stale") }
if ($neighbors) {
Write-Host ""
Write-Host "Neighbors (Reachable/Permanent):"
$neighbors | Select-Object InterfaceIndex, IPAddress, LinkLayerAddress, State | Format-Table -AutoSize
}
else {
Write-Host ""
Write-Host "No reachable or permanent neighbors found on interface $InterfaceIndex." -ForegroundColor Yellow
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment