Created
June 4, 2022 04:53
-
-
Save 4x0v7/771bfca1e387551040fcb8f9b097c709 to your computer and use it in GitHub Desktop.
Get Process listening on Port 6443
This file contains hidden or 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
| Get-Process -Id $(Get-NetTCPConnection -State Listen | Sort-Object -Property LocalPort | Where-Object {$_.LocalPort -eq 6443} | Select-Object -ExpandProperty OwningProcess) | |
| $ListenPort = 6443 | |
| Get-Process -Id $(Get-NetTCPConnection -State Listen | Sort-Object -Property LocalPort | Where-Object {$_.LocalPort -eq $ListenPort} | Select-Object -ExpandProperty OwningProcess) | |
| Get-Process -Id $(Get-NetTCPConnection -State Listen | Sort-Object -Property LocalPort | Where-Object {$_.LocalPort -eq $ListenPort} | Select-Object -ExpandProperty OwningProcess) | Select-Object -ExpandProperty ProcessName |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Get the name of the process that is listening on a Port.
K8s
kube-apiserverlistens on port6443by default