RE: Terminating a Process Tree
From: deadmetal (deadmetal_at_discussions.microsoft.com)
Date: 01/18/05
- Next message: zemanb_at_pbcpny.com: "Re: Error executing .cmd file from VBScript"
- Previous message: florence: "RE: Terminating a Process Tree"
- In reply to: florence: "RE: Terminating a Process Tree"
- Next in thread: mr unreliable: "Re: Terminating a Process Tree"
- Reply: mr unreliable: "Re: Terminating a Process Tree"
- Messages sorted by: [ date ] [ thread ]
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
> >
- Next message: zemanb_at_pbcpny.com: "Re: Error executing .cmd file from VBScript"
- Previous message: florence: "RE: Terminating a Process Tree"
- In reply to: florence: "RE: Terminating a Process Tree"
- Next in thread: mr unreliable: "Re: Terminating a Process Tree"
- Reply: mr unreliable: "Re: Terminating a Process Tree"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|