Powershell to check port connectivity

Welcome Forums General PowerShell Q&A Powershell to check port connectivity

Viewing 2 reply threads
  • Author
    Posts
    • #182883
      Participant
      Topics: 5
      Replies: 8
      Points: 65
      Rank: Member

      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

      telnet 172.16.165.55 3660

      telnet 172.16.165.56 3660

      Thank You

      J

       

    • #182904
      Senior Moderator
      Topics: 8
      Replies: 1140
      Points: 3,922
      Helping Hand
      Rank: Community Hero

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

      • #183150
        Participant
        Topics: 5
        Replies: 8
        Points: 65
        Rank: Member

        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.

      • #183258
        Participant
        Topics: 6
        Replies: 108
        Points: 301
        Helping Hand
        Rank: Contributor

        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
        
    • #182946
      js
      Participant
      Topics: 27
      Replies: 716
      Points: 1,879
      Helping Hand
      Rank: Community Hero
      echo 172.16.165.55 172.16.165.56 | test-netconnection -port 3660
      
Viewing 2 reply threads
  • You must be logged in to reply to this topic.