Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Gets the process name and PID for a given port
$Port = "8080"
netstat -a -n -o | where { $_ -match $Port } | foreach {
$Process = Get-Process -PID (($_ -replace "\s+"," ") -split " ")[-1]
"Process: $($Process.ProcessName) ($($Process.Id)) is using $Port"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment