← script library

List Open TCP Ports and Processes with PowerShell

Security & AuditingAugust 17, 2026

Lists every TCP connection with local and remote address, state and the process ID that owns it. The fastest answer to what is listening on this server, and the starting point for tracking down the service nobody remembers installing.

powershell
# List open ports
#--------------------------------------------

Get-NetTCPConnection | Select-Object LocalAddress, LocalPort, RemoteAddress, RemotePort, State, OwningProcess | Format-Table -AutoSize

Run it across your fleet

This script runs as-is on a single host. Paste it into ServerEngine to schedule it, run it on a whole server group in parallel, and keep the credentials out of the file — see the scripts documentation and the credential store.

Ready when you are.

Try ServerEngine free for 7 days.