info@techdevops.com | 437-991-3573 | Data Engineering Services
TechDevOps.com
Resources Tools
Experts in Microsoft SQL Server on Windows, Linux, Containers | Clusters, Always On, FCI | Migrations, Cloud, Performance



Verify a remote TCP port connectivity using Powershell
by BF (Principal Consultant; Architecture; Engineering)
2016-12-10








If you are required to test whether a remote TCP port is accessible or not and you do not have Telnet configured, let
Powershell step in to do the job.


As Per MSDN:

"Test-NetConnection
Displays diagnostic information for a connection.

Detailed Description
The Test-NetConnection cmdlet displays diagnostic information for a connection. It supports ping test, TCP test, route tracing, and route selection diagnostics. Depending on the input parameters, the output can include the DNS lookup results, a list of IP interfaces, IPsec rules, route/source address selection results, and/or confirmation of connection establishment."



Powershell Cmdlet:

Test-NetConnection -computername sqlxyz -port 1433









If you are getting a Ping failed result, ensure to check Windows Firewall: Inbound Rules: ...Echo Request - ICMP... is enabled. (Ping software utility operates by sending Internet Control Message Protocol (ICMP) Echo Request packets to the target host and waiting for an ICMP Echo Reply)


Resources:

Test-NetConnection