NETSTAT Command

The NETSTAT command is a very handy Windows Diagnostic Tool it will allow you to see all the ports that your server is listening on and the connection status, you can also, with the correct switches view the PID for the process that is making that connection possible.....

netstat -an

This will show you the information shown below:


TCP 0.0.0.0:135 0.0.0.0:0 LISTENING
TCP 0.0.0.0:445 0.0.0.0:0 LISTENING
TCP 127.0.0.1:1065 127.0.0.1:1066 ESTABLISHED
TCP 127.0.0.1:1066 127.0.0.1:1065 ESTABLISHED
TCP 127.0.0.1:1067 127.0.0.1:1068 ESTABLISHED
TCP 127.0.0.1:1068 127.0.0.1:1067 ESTABLISHED


However if you use the command shown below:

netstat -ano

You get the same list with the process ID listed, so you can compare this with the process list in Task Manager, so the first entry for TCP:135 will refer to "svchost.exe"


TCP 0.0.0.0:135 0.0.0.0:0 LISTENING 1144
TCP 0.0.0.0:445 0.0.0.0:0 LISTENING 4
TCP 127.0.0.1:1065 127.0.0.1:1066 ESTABLISHED 1296
TCP 127.0.0.1:1066 127.0.0.1:1065 ESTABLISHED 1296
TCP 127.0.0.1:1067 127.0.0.1:1068 ESTABLISHED 1296
TCP 127.0.0.1:1068 127.0.0.1:1067 ESTABLISHED 1296