Created
February 21, 2013 09:57
-
-
Save jimfdavies/5003602 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.
This file contains 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
$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