Powershell – Test Network Connection

I’m a little embarrassed that i have only just found out about this.

I, like many old timers, have been using telnet to verify network connectivity over certain ports for many years, with commands such as “telnet www.adexis.com.au 443” in order to verify that specific ports are accessible from the machine im working on. This is very handy when an issue arises with certain machines, especially those in more secured parts of the network, are not working for certain things. The network team always says its not them…. and a quick telnet can help with proving or disproving that.

Today, while compiling some information for a MS support case, i needed to demonstrate that the ports were open…. however, one of the issues with telnet is that you either get an error (port is not accessible) or a blank screen (indicating that it is accessible) which isn’t great for relaying information to a 3rd party….

Enter the powershell command “TNC” or test-networkconnection

tnc www.adexis.com.au -port 443

ComputerName : www.adexis.com.au
RemoteAddress : 10.x.x.x
RemotePort : 443
InterfaceAlias : Ethernet
SourceAddress : 10.x.x.x
TcpTestSucceeded : True

 

In order to get a little bit more information, you can add “-informationlevel Detailed”

tnc www.adexis.com.au -port 443 -InformationLevel detailed

ComputerName : www.adexis.com.au
RemoteAddress : 10.x.x.x
RemotePort : 443
NameResolutionResults : 10.x.x.x
MatchingIPsecRules :
NetworkIsolationContext : Private Network
InterfaceAlias : Ethernet
SourceAddress : 10.x.x.x
NetRoute (NextHop) : 0.0.0.0
TcpTestSucceeded : True

 

much more friendly when having to relay the information onto a 3rd party – and something ill be using in place of telnet from here on in.

Leave a Reply