Wednesday 31 January 2018

Powershell: Test a TCP port to see if it is open


Instead of having the trouble of installing Putty or some other program to every new server or workstation you can easily check if a TCP port is open to a specific IP-Address or DNS name with powershell.

Just open up a Powershell console window and type the following command:


Test-NetConnection <IP-Address> -port <TCP Port Number>

Test-NetConnection 123.456.789.101 -port 21

Keep in mind at times the system you are checking the connection to might not like the type of traffic you are sending. In those cases you won't get a positive outcome eventhough the port is open.


No comments:

Post a Comment