powershell,

Native Network Scanner - foreach-object (PowerShell)

agowa338 agowa338 Oct 23, 2015 · 1 min read
Share this

1..255 | foreach-object {
[System.Net.Networkinformation.Ping]::new().Send("192.168.1.$_") } |
where-object {$_.Status -eq "success"} | select Address

Output:

 Address ________ 192.168.1.1 192.168.1.20 ... 

Instead of 1..255 you can also use something like:

(1..3),5,(7..10) => 1, 2, 3, 5, 7, 8, 9, 10
agowa338
Written by agowa338