Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Computing > Computer Support > kill processes

Reply
Thread Tools

kill processes

 
 
sheinaz@gmail.com
Guest
Posts: n/a
 
      06-16-2006
Hi,

I am tryign to write a script which will detect a process and the user
that started this process. Then when the user closes the process, i
want all other processes that are being run by this user to also be
killed. I would appprecaite any help given. thanks.

Just trying to figure out how it will know that the citrix client
process was killed (closed)...


strComputer = "."
Set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2:")

'get list of processes:
Set colOperatingSystems = objWMIService.ExecQuery _
("SELECT * FROM Win32_OperatingSystem")

For Each objOperatingSystem in colOperatingSystems
'find the process and the username
Set colProcessList = objWMIService.ExecQuery("Select * from
Win32_Process
Where Name = 'citrix_client.exe'")

'User currently logged in on computer
set owneruser = colProcessList.ExecMethod_("GetOwner")


'if process dies kill all process with the same users.

'Kill the processes if belongs to the same client name ie user1
Set colProcessList = objWMIService.ExecQuery("Select * from
Win32_Process
Where username = 'user1'")
objProcess.Terminate()
Next


Or instead of comparing usernames: maybe I can just terminate owner
user after that...
Ex:
Set ownerProcessList = objWMIService.ExecQuery("Select * from
Win32_Process
Where username ==owneruser ")
objProcess.Terminate()

except I'm not sure whether I can filter with username.



-shen

 
Reply With Quote
 
 
 
 
why?
Guest
Posts: n/a
 
      06-16-2006

On 16 Jun 2006 12:23:10 -0700, http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:

>Hi,


Have you thought of asking in one of the MS Developer newsgroups? The MS
scripting newsgroups.

The load of WMI documentation at MSDN , the WMI blogs, the WMI / code
forums and mailing lists.

>I am tryign to write a script which will detect a process and the user
>that started this process. Then when the user closes the process, i
>want all other processes that are being run by this user to also be
>killed. I would appprecaite any help given. thanks.


>Just trying to figure out how it will know that the citrix client
>process was killed (closed)...


<snip>

>'if process dies kill all process with the same users.


That's neat considering Citrix will collapse with <1 sec interruption
and everything else is happy for 10-15 seconds.

Oh right, users runs citrix client, browser, news, Citrix dies and you
kill the other local processes as well.

<snip>

Me
 
Reply With Quote
 
 
 
 
sheinaz@gmail.com
Guest
Posts: n/a
 
      06-20-2006
i dont understand what you mean by:

That's neat considering Citrix will collapse with <1 sec interruption
and everything else is happy for 10-15 seconds.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: best program to kill off processes? chuckcar Computer Support 3 07-01-2009 05:36 PM
Kill forked processes kmkz Python 4 02-27-2006 09:36 PM
KILL BABY KILL widescreen drsd2kill DVD Video 3 11-29-2004 09:36 PM
Bava's KILL BABY KILL widescreen drsd2kill DVD Video 0 11-27-2004 12:04 AM
Proper way to kill child processes Bob Swerdlow Python 6 06-16-2004 01:23 PM



Advertisments