Taskkill and Pskill
A very useful utility included with Windows XP and 2003 that a lot of folks may not be familiar with is Taskkill. This is installed in %WINDIR%\SYSTEM32\taskkill.exe. Here's some examples:
TASKKILL /S system /F /IM notepad.exe /T
TASKKILL /PID 1230 /PID 1241 /PID 1253 /T
TASKKILL /F /IM notepad.exe /IM mspaint.exe
TASKKILL /F /FI "PID ge 1000" /FI "WINDOWTITLE ne untitle*"
TASKKILL /F /FI "USERNAME eq NT AUTHORITY\SYSTEM" /IM notepad.exe
TASKKILL /S system /U domain\username /FI "USERNAME ne NT*" /IM *
Nice things are that you can blow stuff away by Window Title, CPU Time, Status, using filters. It's not as flexible as stop-process in MSH, but I'll talk about Monad on this week's Hanselminutes and in a later blog post.
I've got a batch file called cleanprocesses.bat that is filled with "net stop" and "taskkill" commands that takes my number of processes down from my standard 103 to 50. While extreme, I've found that when I'm giving a talk this makes my machine more stable. (Of course, not starting up the superfluous processes in the first place would be more clever.)
If you're running Windows 2000, I like PSKILL as an alternative.
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
About Newsletter
Neat trick though, I'll check it out. Win2k3 has a bunch of addons like this, I haven't had a chance to play with it too much. Considering it is a dual proc opteron system, I really should use it more...
Comments are closed.