Powershell: Determine which process is using a port

1. Simple (dumb) search for port number

Command


PS C:\> netstat -ano | Select-String "8080"

Example Result


TCP 0.0.0.0:8181 0.0.0.0:0 LISTENING 9508
TCP [::]:8181 [::]:0 LISTENING 9508

2. Get Process Name by Id

Command


PS C:\> Get-Process -Id 9508

Example Result


Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
1326 580 421440 356072 1065 52.88 9508 java

[Optional]3. Stop Process

Command


PS C:\> Stop-Process 9508

Leave a Reply

Your email address will not be published. Required fields are marked *