Last active
October 4, 2021 12:47
-
-
Save dadatuputi/470e285b575e0e64850a03818a13dc43 to your computer and use it in GitHub Desktop.
Powershell script to find Raspberry Pis on a local network
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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