Monday, July 10, 2023

Find what process is listeninig on specific port using Powershell

 get-nettcpconnection | where {($_.State -eq "Listen")} | select LocalAddress,LocalPort,RemoteAddress,RemotePort,State,@{Name="Process";Expression={(Get-Process -Id $_.OwningProcess).ProcessName}} | ft 



get-nettcpconnection | where {($_.State -eq "Listen") -and ($_.LocalPort -eq "80")}  | select LocalAddress,LocalPort,RemoteAddress,RemotePort,State,@{Name="Process";Expression={(Get-Process -Id $_.OwningProcess).ProcessName}} | ft

No comments:

Post a Comment