powershell - Get specific value from `netstat` command in windows -
when run command netstat -ano
have:
ps y:\powershell> netstat -ano active connections proto local address foreign address state pid tcp 0.0.0.0:80 0.0.0.0:0 listening 4 tcp 0.0.0.0:135 0.0.0.0:0 listening 376 tcp 0.0.0.0:445 0.0.0.0:0 listening 4 tcp 0.0.0.0:2222 0.0.0.0:0 listening 2364 tcp 0.0.0.0:3389 0.0.0.0:0 listening 1748 tcp 0.0.0.0:5985 0.0.0.0:0 listening 4 tcp 0.0.0.0:6081 0.0.0.0:0 listening 2556 tcp 0.0.0.0:8001 0.0.0.0:0 listening 3772 tcp 0.0.0.0:47001 0.0.0.0:0 listening 4
but wanna is:
active connections
pid 4 376 4 2364 1748 4 2556 3772 4
i can't use: netstat -ano| select pid
because it's not powershell command.
powershell version of netstat get-nettcpconnection , return objects.
get-nettcpconnection -state listen
Comments
Post a Comment