Native Network Scanner – foreach-object (PowerShell)

1..255 | foreach-object { (new-object System.Net.Networkinformation.Ping).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 could use:

  • (1..3),5,(7..10)  => 1, 2, 3, 5, 7, 8, 9, 10

 

Leave a Reply

Your email address will not be published. Required fields are marked *