Monday, January 02, 2017

PowerShell: One Line Ping Scanner

Need to do some basic network exploration, use the one-liners below to see what device are on your network (Note: only setup for Class C, IPv4 networks).

Example 1: Less Detail
0..255|%{$a="192.168.0.$_";$b=Test-Connection -count 1 -ComputerName $a -quiet;If($b){Write-Host $a}}

Example 2: More Detail
0..255|%{$a="192.168.0.$_";$b=Test-Connection -count 1 -ComputerName $a -quiet;If($b){Test-NetConnection -ComputerName $a}}

No comments:

Post a Comment