18 lines
588 B
PowerShell
18 lines
588 B
PowerShell
# Find process using port 5167
|
|
$port = 5167
|
|
$connections = netstat -ano | Select-String ":$port "
|
|
|
|
Write-Host "Connections on port $port :" -ForegroundColor Yellow
|
|
$connections | ForEach-Object {
|
|
Write-Host $_ -ForegroundColor Gray
|
|
if ($_ -match '\s+(\d+)\s*$') {
|
|
$pid = $matches[1]
|
|
try {
|
|
$process = Get-Process -Id $pid -ErrorAction Stop
|
|
Write-Host " PID: $pid - Process: $($process.ProcessName)" -ForegroundColor Cyan
|
|
} catch {
|
|
Write-Host " PID: $pid - Process not found" -ForegroundColor DarkGray
|
|
}
|
|
}
|
|
}
|