Ping hosts from PowerShell (Test-Connection)

The PowerShell-native ping: send ICMP echo requests to several computers in one line and get structured results you can filter and script.

WindowspingtroubleshootingpowershellLow risk
Run Test-Connection example.com -Count 4 to send four pings and receive a structured response object for each.

01Command

Command
$ Test-Connection example.com, gateway.local -Count 4

02What it does

Test-Connection returns objects with properties like Address, ResponseTime and Status, so workflows like 'ping a whole subnet and list only responders' become one pipeline instead of text scraping. It accepts multiple targets in a single call, and in PowerShell 7 the parameter is -TargetName (Windows PowerShell 5.1 uses -ComputerName). Combine with -Quiet to get just a True/False boolean for conditional logic.

03Risk

RiskLow risk

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • Test-Connection - PowerShell - SS64
    SS64 · technical · 2026-09-17
    Evidence: SS64 documents Test-Connection as sending ICMP echo requests to one or more computers, accepting a list of targets and a -Count parameter, and returning status objects usable in pipelines.

Last verified: 2026-09-17 · Category: Network

06Related solutions