I’m sure there were times when you had to check if a port is accessible from one computer to another. In the earlier days we used to test network connectivity to a specific port of the remote computer using telnet command. Telnet used to come preinstalled in Windows, but in latest Windows OS not anymore.

In these days some companies have restrictions on installing third party programs or new services including telnet on their machines. That’s why, in this tutorial we’ll see how can we achieve our goal only with what we have available, without installing anything else.

And what we have available is PowerShell and cmdlet Test-NetConnection . With the -Port parameter, the command will make a TCP three-way handshake on the specified port and report back if the connection succeeded or not.

Test-NetConnection <FQDN/IP Address> -Port <port number>

The Test-NetConnection command will provide you basic information about the network connection like computer name, IP address, Interface, source IP, whether the ping is successful or not, Ping reply time and finally TcpTestSucceeded. TcpTestSucceeded will report as True if the port is open and false if the port is closed. In the above picture you will see the result for both cases.

Conclusion: This PoweShell cmdlet will come in handy every time when you will have to troubleshoot a connection issue. For me it was very useful for a few times and I hope it will be the same for you.



Share:

Leave a Reply

Your email address will not be published.