Scripting and security

Operating Systems, software development, scripting, PowerShell tips, network and security

Primary Menu
  • Home
  • Categories
  • Books
  • Courses
  • Top posts
  • Projects
  • Scripts
Skip to content

Analizar las conexiones que tiene abiertas el proceso que más CPU consume en Windows con PowerShell mediante una función

1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 5.00 out of 5)
Loading...

PowerShell
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
function monitorizar
{
  param()
  begin
  {
  }
  process
  {
    foreach($conex in @(netstat -ano))
    {
        foreach($proceso in ps | where id -EQ ((Get-Process -name chrome | sort cpu -Descending | select -First 1).id))
        {
            if($conex -match $proceso.Id -and $proceso.Id -ne 4 -and $proceso.Id -ne 0)
            {
                write-host $conex “-PROCESO->” $proceso.Name $proceso.Id
            }
        }
    }
  }
  end
  {
  }
}
 
monitorizar


PowerShell Chrome, foreach, Function, Get-Process, match, Netstat, ps, Sort, Windows, Write-Host

Related Articles

Gets the list of cipher suites for TLS for a computer

Almacenar el número de resultados de una búsqueda en Google

WINDOWS POWERSHELL COOKBOOK 3RD EDITION (HOLMES, LEE)

Post navigation

Previous Previous post: Crear una carpeta con la fecha actual (añomesdia) en Windows con PowerShell
Next Next post: Recopilación de Scripts día 30/05/2019