Powershell to check port connectivity

Hi Friends,

I am looking for some help on checking port connectivity from multiple servers to the below. It should give me the output for me see on which ones it is listening and not. Any help is greatly appreciated
<p dir=“LTR”>telnet 172.16.165.55 3660</p>
telnet 172.16.165.56 3660

Thank You

J

 

You might want to look at Test-NetConnection cmdlet, A combination with Invoke-Command might do the job for you.

echo 172.16.165.55 172.16.165.56 | test-netconnection -port 3660

Thank you…!
How do i call the list of servers that i need to test? Get-content? Also, i would like to import the results in a csv format.

Depends on how you have them stored. If you have a list of them in a text file, then Get-Content will work for you.

And you can play with Export-Csv to output the results to a CSV file.

Something like this should get your started:

Get-Content -Path C:\Temp\ServersToCheck.txt | Test-NetConnection -Port 3660 | Export-Csv -NoTypeInformation -Path C:\Temp\ServersOutput.csv