kill processes

Discussion in 'Computer Support' started by sheinaz@gmail.com, Jun 16, 2006.

  1. Guest

    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
     
    , Jun 16, 2006
    #1
    1. Advertising

  2. why? Guest

    On 16 Jun 2006 12:23:10 -0700, 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
     
    why?, Jun 16, 2006
    #2
    1. Advertising

  3. Guest

    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.
     
    , Jun 20, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. William J King

    how to halt DECNET processes

    William J King, Dec 23, 2003, in forum: Cisco
    Replies:
    1
    Views:
    478
    News Account
    Dec 24, 2003
  2. drsd2kill

    Bava's KILL BABY KILL widescreen

    drsd2kill, Nov 27, 2004, in forum: DVD Video
    Replies:
    0
    Views:
    572
    drsd2kill
    Nov 27, 2004
  3. drsd2kill

    KILL BABY KILL widescreen

    drsd2kill, Nov 27, 2004, in forum: DVD Video
    Replies:
    3
    Views:
    690
    drsd2kill
    Nov 29, 2004
  4. chuckcar

    Re: best program to kill off processes?

    chuckcar, Jul 1, 2009, in forum: Computer Support
    Replies:
    3
    Views:
    349
    chuckcar
    Jul 1, 2009
  5. §ñühw¤£f

    Re: best program to kill off processes?

    §ñühw¤£f, Jul 1, 2009, in forum: Computer Support
    Replies:
    0
    Views:
    489
    §ñühw¤£f
    Jul 1, 2009
Loading...

Share This Page