Powershell - Ping a full subnet with a one liner

For ($i=1;1..254;$i++) {ping.exe -n 1 ("192.168.1." + $i) | where{$_ -match "bytes=32"}}

Ever wanted a way to ping an entire subnet and don't have access to a tool to do it?  Well this one liner allows that.

The For at the beginning says the variable $i is equal to one, the semicolon separates it from the amount of times the loop is run 1..254 and then the $i++ increments the loop by 1.  (You can specify every 5th IP if you want)

The next section runs the windows builtin ping.exe command (make sure you include the .EXE extension) with the switch -n (which means number of times) and then in brackets you are specifying the IP to ping.  The where statement at the end is looking for a match of "bytes=32" default output for a successful ping.