Check the range of active ports on the host

Welcome Forums Pester Check the range of active ports on the host

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
8 months ago.

  • Author
    Posts
  • #96669

    Participant
    Points: 0
    Rank: Member

    Good afternoon,
    My question is how to check range of active ports on the host, if you could give me a hint.
    Sorry for the bad english, I'm Brazilian.

  • #96699

    Participant
    Points: 226
    Helping Hand
    Rank: Participant

    Just use a simple loop using a list of ports and the Test-Connection cmdlet.

    Simple example:

        '25','80','389','443','445','589'| %{Test-NetConnection -ComputerName $env:COMPUTERNAME -Port $_}
    
        # Get parameters, examples, full and Online help for a cmdlet or function
    
        # Get a list of all functions
        Get-Command -CommandType Function
    
        # Get a list of all commandlets
        Get-Command -CommandType Cmdlet
    
        # Get a list of all functions for the specified name
        Get-Command -Name '*ADGroup*' -CommandType Function
    
        # Get a list of all commandlets for the specified name
        Get-Command -Name '*ADGroup**'  -CommandType Cmdlet
    
        # get function / cmdlet details
        (Get-Command -Name Test-Connection).Parameters
        Get-help -Name Test-Connection -Examples
        Get-help -Name Test-Connection -Full
        Get-help -Name Test-Connection -Online
    
        Get-Help about_*
        Get-Help about_Functions
    
    
        # Find all cmdlets / functions with a target parameter
        Get-Help * -Parameter Append
    
        Get-Command -CommandType cmdlet `
        | Where-Object { $_.parameters.keys -match 'credential'} `
        | Format-Wide name -AutoSize 
    
        # All Help topics locations
        explorer "$pshome\$($Host.CurrentCulture.Name)"
    
    • #96744

      Participant
      Points: 0
      Rank: Member

      Thank you, my friend, it helped me a lot.

The topic ‘Check the range of active ports on the host’ is closed to new replies.