Use PowerShell to test a TCP port

Have you ever found yourself in a situation where you want to do a port test from a Windows server to another machine only to find that the Telnet client was not installed?

As from PowerShell 4 (Windows 8.1 / Windows Server 2012 R2) you now have the cmdlet Test-NetConnection which provides you with that functionality.

You can do a simple port test as following:

use-powershell-to-test-a-tcp-port_001

You can also test some common protocols like this:

use-powershell-to-test-a-tcp-port_002

And finally, you can also perform a traceroute with this cmdlet:

use-powershell-to-test-a-tcp-port_003

Leave a Reply

Your email address will not be published. Required fields are marked *