$conn = Get-NetTCPConnection -LocalPort 3000 -ErrorAction SilentlyContinue if ($conn) { Write-Host "Port 3000 used by PID: $($conn.OwningProcess)" } else { Write-Host "Port 3000 is free" }