Kaseya Community

Script Task Manager - CPU Utilization

  • Does anyone have a good script/program to launch Task Manager and identify User CPU Usage? Is there a Powershell Script that can do this. I have tried using the process.exe program from Beyond Logic with mixed results.


  • you can create this in the monitor tab. and then create the info in info center

  • What I'm currently doing is when my CPU Utilization Monitor Set generates an Alarm, run a script to list all the Users and their CPU Utilization, then Email the output. Primarily doing this on a couple of RDS Servers.

  • Get-UserProcessorUsage.txt


    Attached is a PS script that I just wrote that I think will suit your needs. Getting the owner information isn't straight forward and then relative processor usage has to be calculated.

    You can modify (of course, any of it you want) the last line that controls the output. Right now it is just outputting a table as a string but all of the process data is maintained from Win32_Process (memory, etc) should you want to email the entire results as XML or anything like that.

    I couldn't attach the file as a .ps1 so it is a .txt extension.

    Usage: powershell.exe -File .\Get-UserProcessorUsage.ps1

    You could optionally pass it a computername: powershell.exe -File .\Get-UserProcessorUsage.ps1 -ComputerName PCYouAreAdminOn.domain.any

    It can be used to populate the Body of Send-MailMessage as well if you need the script to email directly. You could store the output of the script in a Kaseya variable I would imagine but I did not test this. Don't know if it accepts multi-line results or not.

    Good luck,

    Joe Tinney

  • If you're monitoring for performance, what are you doing to optimize the platforms and certify them to be worthy of performance alerting? Without the platform optimization, it's hard to determine what's normal and what's not.

    We have a customer with a 14-node RDS farm that was constantly exceeding performance thresholds, and users complaining about slow response. We deployed some PerfMon data collectors for a week and analyzed the results. Based on that, we made some changes to the platform to optimize their performance. Since then, the only "performance" based alerts we get are "user count exceeded" or "print queue above limit" (which indicates a hung print job). The monitors do swing from green to yellow and back (we use KNM for all performance monitoring, never agent monitors), but they no longer go red and generate alerts unless something actually breaks (app crash consumes RAM or CPU resources).

    Some simple things you can do for RDS platforms are:

    • Set system role for Application, not Background operation.
    • Remove the default pagefile from C, created a dedicated disk (not partition!) for paging, and set the min/max pagefile sizes to match.  You CAN place a small (256/512M) pagefile on C for crash-dump, but if you are getting blue-screens regularly enough to warrant that, you can create it when needed.
    • Defrag the C drive after removing the pagefile and BEFORE creating a new, small pagefile. I've seen "windows managed" pagefiles with over 40 thousand fragments bring a system to a crawl.
    • Put the applications on a separate volume/drive (not partition!). 


  • Hello.  We have monitoring that monitors CPU over 90% for more than a minute.  If so, send an alert but also run a script to capture top ten running processes from task manager at that time and send that output to the kaseya agent documents folder of that PC so we can review at any time.

  • Thanks Joe! I will try your script this weekend.

  • @Datalyst, what kind of script do you run? Can you share? We do the same thing, but use a program. I was taking the output and trying to get the Top-10, etc. like you do.


  • TopTenRunningProcesses.ps1


       @{Name="Process Name"; Expression = {$_.name}},

       @{Name="CPU (%)"; Expression = {$_.PercentProcessorTime}},    

       @{Name="Memory (MB)"; Expression = {[Math]::Round(($_.workingSetPrivate / 1mb),2)}}


    Get-WmiObject -class Win32_PerfFormattedData_PerfProc_Process |

       Select-Object $properties |

       Sort-Object "CPU (%)" -Descending |

       select -First 10 |

       Format-Table -AutoSize