Testing to see if a port is open to a SCOM server when you don’t have Portqry or Telnet

Something that I run across a lot in helping clients test connectivity issues in firewalled environments, is “is there a firewall blocking port 5723 traffic?”

In the past we would use tools like Telnet, or Portqry to test port connectivity, but often this is not installed and not easily available.  Luckily, we always have PowerShell!

Here is a quick and dirty PowerShell script you can run as a single line, to test name resolution and port availability.  Just change the $server value in quotes.

$server = ” scom2.opsmgr.net ” ; $ip = ([System.Net.Dns] :: GetHostAddresses( $server )).IPAddressToString; $tcp = New – Object net.sockets.tcpclient; $tcp .Connect( $server , 5723 ); $out = $tcp .Connected;write – host ” `nPort 5723 test result for ($server) on IP ($ip) : ($out) ”

Here it is as a script, if you want to see it all, but not on a single line:

$server = ” scom2.opsmgr.net ” ;

$ip = ([System.Net.Dns] :: GetHostAddresses( $server )).IPAddressToString;

$tcp = New – Object net.sockets.tcpclient; $tcp .Connect( $server , 5723 );

$out = $tcp .Connected;

write – host ” `nPort 5723 test result for ($server) on IP ($ip) : ($out) “

Posted on August 21, 2018 in SCOM

Share the Story

Back to Top