Solved

windows task manager script

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
Viewers will learn how to maximize accessibility options in an Excel workbook for users with accessibility issues.
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

679 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