The *list-network-neighbors.ps1* Script =========================== This PowerShell script lists all network neighbors of the local computer (using the ARP cache). Parameters ---------- ```powershell /home/markus/Repos/PowerShell/scripts/list-network-neighbors.ps1 [] [] This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. ``` Example ------- ```powershell PS> ./list-network-neighbors.ps1 IPAddress InterfaceAlias LinkLayerAddress State --------- -------------- ---------------- ----- 192.168.178.43 Ethernet 2C-F0-5D-E7-8E-EE Reachable ... ``` Notes ----- Author: Markus Fleschutz | License: CC0 Related Links ------------- https://github.com/fleschutz/PowerShell Script Content -------------- ```powershell <# .SYNOPSIS Lists the (cached) network neighbors .DESCRIPTION This PowerShell script lists all network neighbors of the local computer (using the ARP cache). .EXAMPLE PS> ./list-network-neighbors.ps1 IPAddress InterfaceAlias LinkLayerAddress State --------- -------------- ---------------- ----- 192.168.178.43 Ethernet 2C-F0-5D-E7-8E-EE Reachable ... .LINK https://github.com/fleschutz/PowerShell .NOTES Author: Markus Fleschutz | License: CC0 #> try { if ($IsLinux) { & ip neigh | grep REACHABLE } elseif ($IsMacOS) { & ip neigh | grep REACHABLE } else { Get-NetNeighbor -includeAllCompartments -state Permanent,Reachable | Format-Table -property @{e='IPAddress';width=38},@{e='InterfaceAlias';width=14},@{e='LinkLayerAddress';width=19},@{e='State';width=12} } exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" exit 1 } ``` *(generated by convert-ps2md.ps1 as of 11/20/2024 11:51:56)*