One-Liner: Test-NetConnection Tweaked

Test-Connection is a great tool, but sometimes I would like to ping a list of IPs periodically.

Here’s a little one-liner that will do exactly that:

Get-content -Path ".\ips.txt" | Test-NetConnection | Select-Object Computername, RemoteAddress, @{Name='Milliseconds'; Expression={$_.PingReplyDetails.roundtriptime}}, PingSucceeded 

Just point it to a text file formatted like so:

And here’s the output:

Enjoy!

Leave a Reply

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