This is fairly simply to test if certain host is able to connect to a port or not with Telnet. Some of the new SQL Server installation do not have Telnet installed. In those cases, we can use Powershell to test is the port.
I will use System.Net.Sockets.TcpClient class to accomplish it. Below is the simple statement to get the Port status.
$tcp = New-Object System.Net.Sockets.TcpClient
$tcp.connect(“HOST1″ , 1234 )
The above results as blank where connection is successful, otherwise, you get an error message.
I will use System.Net.Sockets.TcpClient class to accomplish it. Below is the simple statement to get the Port status.
$tcp = New-Object System.Net.Sockets.TcpClient
$tcp.connect(“HOST1″ , 1234 )
The above results as blank where connection is successful, otherwise, you get an error message.
No comments:
Post a Comment