Check If a Remote Network Port Is Open Using Command Line

There were times when we used to test network connectivity of a specific port of the router using telnet command. Telnet used to come pre-installed in Windows but not in Windows 10. We explore different possibilities to check if a remote network port is open using command line options in Windows 10.

Windows 10 does not come with Telnet pre-installed. Even DOS Command Prompt has also become secondary with PowerShell taking the center stage.

Portqry used to be the command of choice for checking remote ports being alive and listening but it was only available up till Windows XP and Windows Server 2003.

Install Telnet in Windows 10

If you are going strictly with a DOS based command then you are left with no option but to install telnet in Windows 10. To install Telnet, follow the instructions below:

  1. Open Command Prompt Run –> cmd
  2. Run the following command:
    pkgmgr /iu:”TelnetClient”
  3. Go to Run –> telnet

Check whether the port is open or not using Command Prompt

To check the network port, follow the instructions below:

Open Telnet using the three steps described above and issue the following command:

open google.com 80

Where google.com is the host you want to test. You can also put an IP address instead of the name. 80 is the port number which you want to probe. You should replace 80 with you desired port number.

If you receive “Press any key to continue” prompt, this means that the port is open and responding to telnet. If you receive “Could not open connection” or a blank screen with blinking cursor, this means the port is closed.

If you receive “Connection to host lost“, this means that the port is open but the host is not accepting new connections.

Check open port using PowerShell

Since Microsoft is pushing PowerShell and CMD has become a legacy system, we should be using PowerShell for most of our working. Let’s check whether a remote network port is open and listening or not.

  1. Open PowerShell by going to Run –> powershell
  2. Run the following command
    tnc google.com -port 80
Checking open port using PowerShell

Checking open port using PowerShell

tns is short for Test-NetworkConnection command. google.com is the host name. You can also put an IP address instead of the host name. You can specify the port number using the -port switch at the end of tnc command.

The TNC command will give you basic information about the network connection like computer name, IP address, Interface through which you are connecting, source IP, whether the ping is successful or not, Ping reply time and finally TcpTestSucceeded. TcpTestSucceeded will give you True if the port is open and false if the port is closed.

These commands and techniques are very useful when you are troubleshooting a network. Please let us know if this has been useful for you in the comments below and we will add more troubleshooting techniques in future.

Interesting Reads Next:

One Response

  1. Steven
    October 25, 2019

Leave a Comment