PSLANScan is a PowerShell module for layer 2 host discovery via ARP. It quickly finds live hosts on your network segment given a list of IP addresses, even if the hosts have ICMP/ping blocked by a firewall.
Install-Module -Name PSLANScan -Scope CurrentUser
Clone the repository and run .\build.ps1 deploy
.
This will install several modules if you do not already have them, see build.ps1
for details. These are only required for the build process and are not otherwise used by PSLANScan
.
Copy the files from src
to $Home\Documents\WindowsPowerShell\Modules\PSLANScan
for PowerShell 5.1 or $Home\Documents\PowerShell\Modules\PSLANScan
for PowerShell 7, and rename the .ps1
file(s) to .psm1
.
Find-LANHosts [-IP <String[]>] [-NetAdapter <CimInstance[]>] [-DelayMS <int>] [-ClearARPCache]
Find-LANHosts
Find-LANHosts -ClearARPCache -DelayMS 5
Get-NetAdapter -Name Ethernet | Find-LANHosts
Get-NetAdapter | ? {($_ | Get-NetIPAddress -AddressFamily IPv4 -ErrorAction SilentlyContinue) -ne $null} | Find-LANHosts
Get-NetRoute -DestinationPrefix 0.0.0.0/0 | Get-NetAdapter | Find-LANHosts
$IPs = 1..254 | % {"192.168.0.$_"}
Find-LANHosts $IPs
1..254 | % {"192.168.1.$_"} | Find-LANHosts -ClearARPCache
1..254 | % {"10.1.1.$_"} | Find-LANHosts -DelayMS 5
See this blog post for further details.