PsPing - CMD


Overview

PsPing is a command-line utility that enables network diagnostics by measuring network performance, latency, and bandwidth. Developed by Microsoft as part of the SysInternals suite, it is an enhanced tool compared to traditional utilities such as ping and tracert. PsPing can be used for network tests on both TCP/IP and ICMP, and it is particularly useful in monitoring server health and network service performance.

Syntax

The basic syntax for PsPing is as follows:

psping [options] <destination>[:<port>]
  • <destination> can be a hostname or an IP address.
  • <port> specifies the target port number for TCP/IP network tests.

Depending on the mode of operation, the syntax varies:

  • Latency test:
    psping -i <interval> -n <count> <target>
  • Bandwidth test:
    psping -b <target>[:<port>]
  • TCP connection testing:
    psping -t <target>[:<port>]

Options/Flags

  • -i <interval>: Specifies the interval in seconds between packets sent; default is 1 second.
  • -n <count>: Sets the number of requests to send in a test.
  • -b: Enables bandwidth testing mode, measuring the data throughput.
  • -t: Continuously pings the target until stopped manually, often used for monitoring.
  • -q: Quiet mode, which suppresses the display of the header and summary.
  • -p <port>: Specifies the port number for TCP/IP tests.
  • -4: Forces the use of IPv4.
  • -6: Forces the use of IPv6.

Examples

  1. Standard Ping Test:
    psping 192.168.1.1
    
  2. Measure Latency to a Server:
    psping -i 0.5 -n 20 example.com
    
  3. Bandwidth Test to a Server on Port 80:
    psping -b example.com:80
    
  4. Continuous Ping for Monitoring:
    psping -t example.com
    

Common Issues

  • Resolution Failure: Sometimes, PsPing may fail to resolve the hostname. It’s recommended to confirm DNS settings and try using the IP address directly.
  • Permission Errors: Running PsPing might require administrative rights especially when a low-numbered port is accessed.
  • Firewall Issues: Be sure to configure firewalls to allow PsPing; failure to do so can result in lost packets and inaccurate test results.

Integration

PsPing can be combined with scripting in PowerShell or batch files to automate monitoring and logging tasks. For instance:

@echo off
:LOOP
psping example.com -n 10 -i 1 >> log.txt
timeout /t 600
goto LOOP

This script periodically logs latency data to a file for analysis.

  • Ping: Classic command to check network connectivity.
  • Tracert: Traces path packets take to a network host.
  • PathPing: Combines ping and tracert features to provide more detailed network path analysis.

For more information, check the Sysinternals website or the specific PsPing page for updates, detailed guides, and additional tips on usage.