Stopping Processes - Permission Errors
- From: "Martypi" <Martypi@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 8 Aug 2005 08:48:48 -0700
I need to stop a set of processes periodically. The snippet of code that I'm
using to try and kill the processes is:
Set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate}!\\" & cComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery ("Select * from Win32_Process
Where Name = '" & strProcessName & "'")
For Each objProcess in colProcessList
RetVal = objProcess.Terminate()
I am an administrator on the server. When I try to run the script, it will
kill some of the desired processes, but others I get permission denied. I
can go into Task Manager and kill the processes with no problem.
Any ideas on what I'm doing wrong?
Thanks,
Marty
.
- Follow-Ups:
- Re: Stopping Processes - Permission Errors
- From: Torgeir Bakken \(MVP\)
- Re: Stopping Processes - Permission Errors
- Prev by Date: Re: Event log msg
- Next by Date: RE: Script not work with server 2003
- Previous by thread: Script not work with server 2003
- Next by thread: Re: Stopping Processes - Permission Errors
- Index(es):
Relevant Pages
|