Get-NetTCPConnection

Get TCP connections.

Syntax
      Get-NetTCPConnection [[-LocalAddress] String[]] [[-LocalPort] UInt16[]] [-AppliedSetting AppliedSetting[]]
         [-CimSession CimSession[]] [-CreationTime DateTime[]] [-OffloadState OffloadState[]]
            [-OwningProcess UInt32[]] [-RemoteAddress String[]] [-RemotePort UInt16[]]
               [-State State[]] [-ThrottleLimit Int32] [CommonParameters]

Key
   -AppliedSetting [AppliedSetting[]]
       An array of values of applied settings. Gets connections that match the settings specified.
         Accepted values: 
         • Internet
         • Datacenter
         • Compat
         • Custom

   -CimSession [CimSession[]]
       Run the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such 
       as the output of a New-CimSession or Get-CimSession cmdlet. The default is the current session on the local 
       computer.

   -CreationTime [DateTime[]]
       An array of DateTime objects. To get a DateTime object, use the Get-Date cmdlet.

   -LocalAddress [String[]]
       An array of local IP addresses. Gets connections for the addresses that you specify.

   -LocalPort  [UInt16[]]
       An array of local ports. Gets connections for the ports that you specify.

   -OffloadState [OffloadState[]]
       The offload state of a TCP connection.

   -OwningProcess [UInt32[]]
       The PID of the owning process of a TCP connection.

   -RemoteAddress [String[]]
       An array of remote IP addresses. Gets connections for the addresses that you specify.

   -RemotePort [UInt16[]]
       An array of remote ports. Gets connections for the ports that you specify.

   -State [State[]]
       Get connections that match the states that you specify. Specifies an array of TCP states. 
         Accepted values: 
         • Closed
         • CloseWait
         • Closing
         • DeleteTCB
         • Established
         • FinWait1
         • FinWait2
         • LastAck
         • Listen
         • SynReceived
         • SynSent
         • TimeWait

    -ThrottleLimit
        The maximum number of concurrent operations that can be established to run the cmdlet. If this 
        parameter is omitted or a value of 0 is entered, then PowerShell will calculate an optimum throttle limit 
        for the cmdlet based on the number of CIM cmdlets that are running on the computer.
        The throttle limit applies only to the current cmdlet, not to the session or to the computer.

Standard Aliases for Get-NetTCPConnection: none

The Get-NetTCPConnection cmdlet gets current TCP connections. Use this cmdlet to view TCP connection properties such as local or remote IP address, local or remote port, and connection state.

Examples

Get all connections:

PS C:\> Get-NetTCPConnection

Get only established connections:

PS C:\> Get-NetTCPConnection –State Established

Get Internet TCP connections:

PS C:\> Get-NetTCPConnection –AppliedSetting Internet

Get all HTTPS connections on port 443:

PS C:\> Get-NetTCPConnection -RemotePort 443 -State Established

“You may say I'm a dreamer, but I'm not the only one. I hope someday you'll join us...” ~ John Lennon

Related PowerShell Cmdlets:

Script to resolve IP addresses and the program maintaining each connection - Idera.com
Set-NetTCPSetting - Modify a TCP setting.
Test-NetConnection - Display diagnostic information for a connection.
NETSTAT - Display current TCP/IP network connections and protocol statistics.


 
Copyright © 1999-2021 SS64.com
Some rights reserved