获得高利用率 CPU% + 导致它的服务/进程

问题描述 投票:0回答:0

我想知道是什么服务导致了下面现有代码中的高 CPU 利用率。 该代码运行良好并向我发送通知,但我只需要添加在那段时间内哪些进程或服务很高。感谢您的帮助!

while($true){
    if((Get-Counter -Counter "\Processor(_Total)\% Processor Time").CounterSamples.CookedValue -ge 90){
        Send-MailMessage -Body "CPU is high at 90% on my PC" -From "[email protected]" -SmtpServer "xxx.xxx.xxx" -Subject "CPU High on my PC" -To $recipients

    }
    Start-Sleep -Seconds 60
time counter performancecounter processor
© www.soinside.com 2019 - 2024. All rights reserved.