PsPing is a command-line utility from the Microsoft Sysinternals suite used for measuring network performance, including latency, TCP/UDP ping, and bandwidth. It is particularly useful because it can perform TCP pings to specific ports, which standard Windows ping (ICMP) often cannot do through firewalls.
Key Features
ICMP Ping: Standard ping functionality to check connectivity.
TCP Ping: Tests connectivity and latency to a specific TCP port on a target machine.
Latency Measurement: Measures round-trip time (RTT) for sending data packets of a specified size.
Histograms: Can generate a latency distribution histogram for detailed analysis.
How to Use PsPing for Latency Tests
Download PsTools: PsPing is part of the PsTools suite available from Microsoft Learn https://live.sysinternals.com/.
Extract the Files: Unzip the package to a directory on your computer (e.g., C:\Perf).
Open Command Prompt: Open a Command Prompt or PowerShell window and navigate to the directory where you extracted PsPing.
Run the Command: Execute the appropriate command based on your testing needs.
Common Commands
Basic TCP Ping (Latency Check):
psping <destination>:<port>
psping google.com:443
Troubleshooting: A common example is checking a remote port (like the RDP port \(3389\)) by using a command like
psping -accepteula hostaddress:3389
psping -accepteula is a command-line parameter used to automatically accept the end-user license agreement (EULA) for the Sysinternals psping tool, allowing you to run the command without a manual prompt the first time you use it
Specify Number of Pings (-n):
psping -n <count> <destination>:<port>
Use code with caution.
*Example: psping -n 100 google.com:80 will send 100 pings.
Print a Latency Histogram (-h):
psping -h <destination>:<port>
Use code with caution.
*Example: psping -h google.com:80 produces a histogram of the results.
Test with a Specific Payload Size (-l):
This is useful for simulating specific network traffic or testing MTU sizes.
psping -l <request size> <destination>:<port>
Use code with caution.
*Example: psping -l 8k google.com:80 sends 8KB packets.
Psping with Date and Time stamps for easy detection Time based outages
start powershell.exe 'psping -n 8s -i 0 mail.google.com:443 | ForEach-Object { "{0} - {1}" -f (Get-Date), $_ } > c:\PingTest\Gmail_result.txt'
^It will create a log text file in C: Drive Ping Test Folder.
-n 8s:
The -n flag specifies the number of pings or the duration in seconds to run the test. The 8s suffix means the test will run for a total of 8 seconds rather than sending a fixed number of packets.
-i 0:
The -i flag sets the interval between pings in seconds. Specifying 0 tells PsPing to send requests as fast as possible without any intentional delay, providing a high-speed ping test.
| ForEach-Object { "{0} - {1}" -f (Get-Date), $_ }:
This is a PowerShell pipe that processes the output from the psping command line by line.
ForEach-Object runs a script block for every item in the pipeline. In this case, each line of text output from PsPing is treated as an item ($_).
"{0} - {1}" -f (Get-Date), $_: This formats a string for each output line.
{0} is replaced by the current date and time obtained via (Get-Date).
{1} is replaced by the current line of output from PsPing ($_).
The result is a timestamped log entry.
Purpose
This command is used for a detailed, high-frequency, time-bound network performance test. It allows you to collect many latency samples over a short, specific duration (8 seconds) with timestamps for later analysis or real-time monitoring.
For Continuous Ping test you can use Below command with Date and time logging option
start powershell.exe 'psping -i 0 mail.google.com:443 | ForEach-Object { "{0} - {1}" -f (Get-Date), $_ } > c:\PingTest\Gmail_result.txt'