RE: Terminating a Process Tree

From: deadmetal (deadmetal_at_discussions.microsoft.com)
Date: 01/18/05


Date: Tue, 18 Jan 2005 09:25:08 -0800

Thank You for taking the time to give a reply

Do you think you would be able to help me loop the the child deletion? As
Children of child process are still left running.

TIA

Best Regards

Gary

"florence" wrote:

> Hi,
> This should to it, though I haven't tested :
>
> Set colProcessList = objWMIService.ExecQuery _
> ("Select * from Win32_Process Where Name = 'calc.exe'")
> For Each objProcess in colProcessList
> set colChildrenList = objWMIService.ExecQuery _
> ("Select * from Win32_Process Where ParentProcessID = " &
> objProcess.ProcessID)
> For Each objChild in colChildrenList
> objChild.Terminate()
> next
> objProcess.Terminate()
>
> Next
>
>
> Flo
>
> "deadmetal" wrote:
>
> > Hello There
> >
> > I'm using the following code to script the termination of a process, but I
> > was wondering if someone would be kind enough to help me re-write this so
> > that it will terminate any child processes as well, I would really appreciate
> > it
> >
> > Best Regards
> >
> > Gary
> > strComputer = "."
> > Set objWMIService = GetObject("winmgmts:" _
> > & "{impersonationLevel=impersonate,(debug)}!\\" & strComputer &
> > "\root\cimv2")
> >
> > Set colProcessList = objWMIService.ExecQuery _
> > ("Select * from Win32_Process Where Name = 'calc.exe'")
> >
> > For Each objProcess in colProcessList
> > objProcess.Terminate()
> > Next
> >



Relevant Pages

  • SIG CHLD signal
    ... the stop of the child process or the termination. ... TIA ... NIRAJ KUMAR ...
    (comp.os.linux.development.system)
  • SIGCHLD Signal
    ... the stop of the child process or the termination. ... TIA ... NIRAJ KUMAR ...
    (comp.unix.programmer)
  • Re: Shared memory and error 997
    ... "Matthew Ireland" wrote in message ... > In child process ... Where is the check that the call to OFM() failed? ... Regards, ...
    (microsoft.public.vc.language)
  • Re: Cadence InterProcess Communication - "hiSetBindKey freeze the Child Process"
    ... In my earlier post I cannot send data in my child process because I ... have set a binding. ... Best regards, ... You should really post some code if you want relevant feedback. ...
    (comp.cad.cadence)
  • Re: linux redirect problem
    ... inherits that buffer before it is flushed, ... the parent process will not flush it's output until the termination ... the child process will not flush it's output until the termination ...
    (comp.lang.c)