Solved

windows task manager script

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

758 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

20 Experts available now in Live!

Get 1:1 Help Now