Skip to content

Troubleshooting network applications with PowerShell and tnc

When a network application (such as a website, mail server, or database) is not responding, you can use PowerShell to test connectivity. Test-NetConnection cmdlet (alias: tnc) is a powerful built-in tool for diagnosing network issues.

  • Test-NetConnection(or tnc) is a PowerShell cmdlet available in Windows 8.1, Windows Server 2012 R2, and later.
  • It combines the functionality of ping, traceroute, and port testing into one command.
  • It helps determine if a host is reachable and whether a specific service port is open.

Check if a host is reachable:

Powershell
tnc example.com
  • Returns ping results, IP address, and basic connectivity status.

Check if a service port is open (e.g., HTTPS on port 443):

Powershell
tnc example.com -Port 443
  • Useful for testing web servers, mail servers, or custom applications.

See the path packets take to reach the destination:

Powershell
tnc example.com -TraceRoute
  • Helps identify where along the route packets are being dropped or delayed.

Get extended diagnostic information:

Powershell
tnc example.com -Port 25 -InformationLevel Detailed
  • Useful for troubleshooting mail servers (SMTP on port 25).
  • Website not loading → Test port 80 (HTTP) or 443 (HTTPS).
  • Email not sending → Test ports 25, 465, or 587 (SMTP).
  • Database connection issues → Test the database port (e.g., 3306 for MySQL, 1433 for SQL Server).
  • General connectivity issues → Use -TraceRoute to see where the connection fails.