IT Toolbox

Test access to a TCP port with PowerShell

View my favorites
PowerShell Low risk

Test access to a TCP port with PowerShell

Checks if a server responds to a specific TCP port and displays useful network information.

Command / script
$Serveur = "serveur.exemple.fr"
$Port = 443

Test-NetConnection -ComputerName $Serveur -Port $Port -InformationLevel Detailed

When should you use it?

Use this when an application, website, VPN, or remote service appears to be unreachable.

What the script does

  • Replace the server name and port number with the target you want to test.
  • The TcpTestSucceeded property indicates whether the TCP connection succeeded.
  • The result also shows the resolved IP address and the network interface used.

Precautions

  • A failed test does not prove that the server is down: a firewall may be blocking the port.
  • Test from more than one workstation or network before drawing a conclusion.

Rollback

No rollback is required: this command does not modify the system.

♡ 0