Windows - How to know which program takes a port ?

About

The management of the port with Windows.

How can I know which ports are available ?

When you install software, you need often to verify the available port in order to configure the component installation.

With powershell

With powershell.

For the port 9003, for instance

Get-Process -Id (Get-NetTCPConnection -LocalPort 9003).OwningProcess

Output:

Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName
-------  ------    -----      -----     ------     --  -- -----------
   3600     486  4316388    4542152  15,464.75  19472   1 idea64

With TcpView

Download Tcpview and launch the .exe with the same name.

With Netstat

Just perform this instruction in a command dos.

netstat -abo | findstr ThePortNumber

Here below, we can see that Skype take the port 80 (http) or that googlewebaccclient the port 9100.

netstat -ab
Active Connections

  Proto  Local Address          Foreign Address        State           PID
  TCP    NGERARD:http           NGERARD.nf.newfrontiers.nl:0  LISTENING       2804
  [Skype.exe]
  TCP    NGERARD:9100           NGERARD.nf.newfrontiers.nl:1526  LISTENING    3748
  [googlewebaccclient.exe]
  .....

With the options -b -v netstat determines which is PID is the originator of the port usage.


Powered by ComboStrap