I'm looking to write a script that will query all processes, CPU usage and the username of the process. I have found scripts that will give me the process and CPU usage, but not the username. I am trying to automate a script that will look for processes that are using too much CPU and terminate them. For example:
On a terminal server 10 users are running the same application: 'Office.exe'
All users instances of 'Office.exe' were running fine except for user 5. User 5 has opened 4 instances of 'Office.exe' and each instance is using 25% CPU on a quad core system (all 4 cores are maxxed out). This bogs down the server. I would need the script to recognize the process and username that is associated with the process so it could terminate the process only for that user.