Created
March 12, 2019 14:33
-
-
Save Tiberriver256/aff9a22e7a7bcd0b9a29a6bd0890a582 to your computer and use it in GitHub Desktop.
Gets the process name and PID for a given port
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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