Monthly Archive


Ping a subnet

I recently needed to find which IP addresses were active on a subnet to track down a printer. Quickest way was to ping them.


function ping-subnet {            
param (            
0..255 | foreach {             
 $address = "$subnet.$_"            
 if (Test-Connection -ComputerName $address -Count 1 -Quiet){            
    Test-Connection -ComputerName $address -Count 1            


Put the subnet in as a parameter. Then work through 0 – 255 building an address from the subnet. use test-connection in quiet mode and if it responds do a 1 count test-connection (ping) to get the result.

Not necessarily the quickest but it was quick to throw together and it works

Leave a Reply