Netstat filtering / Get-NetTCPConnection

Aus Wiki-WebPerfect
Wechseln zu: Navigation, Suche

Port-Filter (example Port 443)

netstat -ano | findstr :443

or

Get-NetTCPConnection -RemotePort 9998

IP-Filter (example IP 192.168.1.100)

netstat -ano | findstr 192.168.1.100:


IP- & Port-Filter (example IP = 192.168.1.100, Port = 443) and only established connections

netstat -ano | findstr 192.168.1.100:443 | findstr ESTABLISHED


Port-Filter in a loop (example Port 443)

 while($true){netstat -ano | findstr :443}


Count with Port & Connection-State Filter

netstat -an|find /i "9998"|find /i "ESTABLISHED" /c

or

((Get-NetTCPConnection -RemotePort 9998 -State Established).State).count


More Information about netstat: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/netstat