?
Solved

windows task manager script

Posted on 2013-11-01
4
Medium Priority
?
385 Views
Last Modified: 2013-11-11
I'm trying to figure out the best way to script for a specific process in the windows task manager (devenv.exe*), taskkill the process(s), and email the user name of each process killed. I would appreciate a push in the write direction. I'm not sure whether to split this in to 3 different batch files.
1. tasklist specific tasks to text file
2. taskkill from the list
3. email from the list

As i said, I would really appreciate some direction on this. I'm not really sure of the best way to proceed on this.

thank you.
0
Comment
Question by:huskeraider
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 6

Expert Comment

by:Biniek
ID: 39618061
0
 

Author Comment

by:huskeraider
ID: 39621784
right. I have the Sysinternals Utilities installed. Maybe PsKill and PsList offer more options than Taskkill and Tasklist. I'll do some comparing and see which is better.
0
 

Accepted Solution

by:
huskeraider earned 0 total points
ID: 39628751
I took care of this by using Tasklist and Taskkill in a simple .bat file.


echo off
tasklist /fi "imagename eq devenv.exe" /fi "username eq jones" |find ":" > nul > tasklistjones.txt
if errorlevel 1 taskkill /f /fi "imagename eq devenv.exe" /fi "username eq jones" blat tasklistjones.txt -t jones@email.com -s "Devenv.exe Processes with your username have been deleted. See text for details"
if errorlevel 0 blat tasklistjones.txt -t jeff.underwood@rainhail.com -s "Mindy Smith: No devenv.exe tasks are running which match your username."
0
 

Author Closing Comment

by:huskeraider
ID: 39638317
I found the answer before i received any assistance and posted the result here in case someone else could use it.
0

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question