kill a process in task manager only for a certain user name

Hello experts,

Is there a way to get the user who owns the process in the Process[] collection retrieved by Process.GetProcessByName("ANYNAME")?

I see more than one instance and I only want to kill the process that belongs to a specific user. The server is a terminal server by the way. Thanks in advance,

Alpha Guys
AlphaGuysAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mjmarlowCommented:
Someone already answered this more or less:
http://www.experts-exchange.com/Programming/Q_21769176.html
0
Alexandre SimõesManager / Technology SpecialistCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
anand2kCommented:
Hi,

If u r running Windows XP, simply use
 TASKKILL /S system /U username /P password /FI "IMAGENAME eq note*"

Goto Command Prompt and type "TASKKILL /?" which will kill the exact Process for that user on ur local box or any remote machine, provided the user logged in has Admin privilage on the remote or local box because thats under OS Kernal. :-)

In another OS, i guess just copying the TASKKILL from windows XP to target OS is sufficient. Not 2 sure abt it.

Anand
0
AlphaGuysAuthor Commented:
Thanks for the answers guys, looks like Alex pointed out a good link. My application runs on a terminal server (WIN2k3server) and a number of users can log on and run my application. My main concern is the hanging Office and sometimes Adobe applications. I would like to kill those processes(EXCEL.EXE, WINWORD.EXE, etc) from my application but only for the user who is running that application. I will try out Alex's link and see if I can do it even with the users just having limited permissions. Thanks again for all your help!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Fonts Typography

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.