Skip to content

Instantly share code, notes, and snippets.

@dadatuputi
Last active October 4, 2021 12:47
Show Gist options
  • Save dadatuputi/470e285b575e0e64850a03818a13dc43 to your computer and use it in GitHub Desktop.
Save dadatuputi/470e285b575e0e64850a03818a13dc43 to your computer and use it in GitHub Desktop.
Powershell script to find Raspberry Pis on a local network
# https://learn-powershell.net/2016/04/22/speedy-ping-using-powershell/
# Scan the local network
$Hosts = 1..254 | foreach {"192.168.1.$_"}
$Tasks = $Hosts | foreach {(New-Object System.Net.NetworkInformation.Ping).SendPingAsync($_)}
[Threading.Tasks.Task]::WaitAll($Tasks)
#$Tasks.Result
# Scan the arp table for MAC addresses that are registered to the Pi Foundation
arp -a | select-string "b8-27-eb" |% { $_.ToString().Trim().Split(" ")[0] }
arp -a | select-string "dc-a6-32" |% { $_.ToString().Trim().Split(" ")[0] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment