Count Network Connections

From NazimWIKI
Jump to navigation Jump to search

To get a count of the number of network connections on a Windows server, you can use the following batch script:

REM list network connections and write them to a file
netstat -n > netstat_count.txt

REM search for non-existent string in file and return line count instead
find /v /c "zzz" netstat_count.txt

This returns something like ...
---------- NETSTAT_COUNT.TXT: nnn