Solved

windows task manager script

Posted on 2013-11-01
4
366 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

We were having a lot of "Heartbeat Alerts" in our SCOM environment, now "Heartbeat" in a SCOM environment for those of you who might not be familiar with SCOM is a packet of data sent from the agent to the management server on a regular basis, basic…
Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

867 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now