Skip to content

Instantly share code, notes, and snippets.

@chris1984
Forked from jimfdavies/pingsweep.ps1
Created March 27, 2018 20:34
Show Gist options
  • Save chris1984/05fba70b8936f78c677a59dd753523ab to your computer and use it in GitHub Desktop.
Save chris1984/05fba70b8936f78c677a59dd753523ab to your computer and use it in GitHub Desktop.
Quick script to ping a subnet and report if each IP address is used or 'empty'. Can be extended to redirect to a file if desired.
$subnet24 = "10.10.1"
1..254 |
foreach-object {
$ip = $subnet24 + "." + $_
if (test-connection $ip -count 1 -quiet) { Write-Host "USED:$ip" } else { Write-Host "EMPT:$ip" }
}
#USED:10.10.2.1
#EMPT:10.10.2.2
#...
#USED:10.10.2.254
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment