Get-Nettcpconnection bring the event Count

Asked

Viewed 73 times

3

How can I count the amount of return using this powershell parameter?

In cmd I can execute the command below:

C:\Users\admin>netstat -ano |find "8000"
  TCP    0.0.0.0:8000           0.0.0.0:0              LISTENING       14112

C:\Users\admin>
C:\Users\admin>netstat -ano |find "8000" /c
1

Is there a similar one for Powershell ? I need the result to be recorded along with a date and time.

Ex: 1 - 18/12/2019 22:00:00

1 answer

3

Goes below:

"" + (Get-NetTCPConnection | where { $_.RemotePort -eq 443}).Count + " - " + (Get-Date)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.