Welcome › Forums › General PowerShell Q&A › Powershell to check port connectivity
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
telnet 172.16.165.55 3660
telnet 172.16.165.56 3660
You might want to look at Test-NetConnection cmdlet, A combination with Invoke-Command might do the job for 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
echo 172.16.165.55 172.16.165.56 | test-netconnection -port 3660