I would like to know what service that is causing the high CPU utilization into the exisitng code below. the code works well and sends noticication to me but i just need to add what process or service was high during that time. Thanks for the help!
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 "MyPC@XXXXX" -SmtpServer "xxx.xxx.xxx" -Subject "CPU High on my PC" -To $recipients
}
Start-Sleep -Seconds 60