May 6, 2021

How To Check Port Connection Using Powershell In Windows

mr rockstar

A port is the part of a network address that causes the assignment of TCP and UDP connections and data packets to server and client programs by operating systems. Each connection of these two protocols has two ports, one on the client and one on the server.

We will use today Test-NetConnection cmdlet

The Test-NetConnection cmdlet displays diagnostic information for a connection. It supports ping test, TCP test, route tracing, and route selection diagnostics. Depending on the input parameters, the output can include the DNS lookup results, a list of IP interfaces, IPsec rules, route/source address selection results, and/or confirmation of connection establishment.

So we will go through Some Normal Processes – Check Port Connection.

  • In the Run prompt (Win + R), Type “Powershell”, and hit the Enter key.
  • It will open the Windows Powershell console.

  • Modify the example command below, replacing IP address and port.
    • Test-NetConnection -ComputerName 192.168.1.1 -Port 44

  •  If the port test succeeds, it will show “TcpTestSuceeded: True”, which means your server Is online.
  • If output Result “TcpTestSuceeded: False”, which means your server Is Offline or Blocked.

Here are more command you can use it also

  • Test ping connectivity
    • Test-NetConnection
  • Test ping connectivity with detailed results
    • Test-NetConnection -InformationLevel “Detailed”
  • Test TCP connectivity and display detailed results
    • Test-NetConnection -Port 80 -InformationLevel “Detailed”
  • Test a connection to a remote host
    • Test-NetConnection -ComputerName “www.contoso.com” -InformationLevel “Detailed”
  • Perform route diagnostics to connect to a remote host
    • Test-NetConnection -ComputerName www.contoso.com -DiagnoseRouting -InformationLevel Detailed
  • Perform route diagnostics to connect to a remote host with routing constraints
    • Test-NetConnection -ComputerName “www.contoso.com” -ConstrainInterface 5 -DiagnoseRouting -InformationLevel “Detailed” ComputerName : www.contoso.com

If you would like to suggest any additions or updates to this page, please let us know.

Popular Blog Posts