Link to home
Start Free TrialLog in
Avatar of patriots
patriots

asked on

Powershell script to kill process based on processor utilization

I'm using this command to kill winword.exe processes on a server we have that uses MS Word for a document conversion process.  Because of a bug in this process, the winword.exe process is being left open when the conversion should close it after it completes.  Until a bug fix is released for the third-party app involved, I would like to devise a method to kill these processes.  I know I can use this power shell command:

stop-process -Name winword* -force

it works just fine.  However, I'd like to automate it if possible.  I was wonder if it would be possible to put this in a PowerShell script that will do the following:

1. run the stop-process command for winword.exe if a certain total processor threshold is crossed...let's say 75%.
2. close all winword.exe processes older than 2 minutes.
3. send an alert via email when script is run

I'm still learning pshell, and I know this is a little fancier than what I'm used to doing, so i was wondering if anyone had any ideas on how to accomplish these goals.

Thanks!
Avatar of Brent Challis
Brent Challis
Flag of Australia image

How do you want to define utilisation?  Is it per processor or per core?  Are you concerned with multi processor (as opposed to multi core) systems?
ASKER CERTIFIED SOLUTION
Avatar of Brent Challis
Brent Challis
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial