Pinging Multiple Systems Fast

by Jan 15, 2016

Test-Connection can ping multiple computers only sequentially, and it does not let you specify a timeout. So when you need to check a large number of systems, it is very slow.

A much faster way is to use the underlying WMI and instruct it to ping multiple systems simultaneously:

$ComputerName = '', '', ''
$Timeout = 2000
$filter = 'Address="' + ($ComputerName -join """ and Timeout=$Timeout or Address=""") + """ and Timeout=$Timeout"

Get-WmiObject -Class Win32_PingStatus -Filter $filter |
  Select-Object -Property Address, ProtocolAddress, ResponseTime, Timeout

The result comes in almost instantaneously:

Address                ProtocolAddress             ResponseTime Timeout
-------                ---------------             ------------ -------      2400:cb00:2048:1::6818:7c40           27    2000                      117    2000                        161    2000 

When you look at the constructed WMI filter, it looks like this:

PS C:\> $Filter
Address="" and Timeout=2000 or Address="" and Timeout=2000 or Address="" and Timeout=2000 

As you see, you can set the timeout for each individual computer.

Throughout this month, we'd like to point you to two awesome community-driven global PowerShell events taking place this year:

Europe: April 20-22: 3-day PowerShell Conference EU in Hannover, Germany, with more than 30+ speakers including Jeffrey Snover and Bruce Payette, and 60+ sessions (

Asia: October 21-22: 2-day PowerShell Conference Asia in Singapore. Watch latest annoncements at

Both events have limited seats available so you may want to register early.

Twitter This Tip! ReTweet this Tip!