Mike Gagnon
Programmer
Here are a couple of functions that might be of use. The first one creates a cursor of the currently running processes, and the second one requires a parameter of the running process you want to kill (This will kill all instances of THAT process). (Note this requires Windows Sripting 5.6 installed, and can only be run on the computer that has the runnning processes)
Note: these will added to an on-growing FAQ.
Mike Gagnon
If you want to get the best response to a question, please check out FAQ184-2483 first.
Code:
FUNCTION enumerateProcess
lcComputer = "."
loWMIService = Getobject("winmgmts:" ;
+ "{impersonationLevel=impersonate}!\\" + lcComputer + "\root\cimv2")
colProcessList = loWMIService.ExecQuery ;
("Select * from Win32_Process")
Create Cursor Process (Name c(20),Id i,Thread i,pagefile i,pagefault i,workingset c(20))
Index On Name Tag Name
For Each loProcess In colProcessList
Insert Into Process (Name,Id,Thread,pagefile,pagefault,workingset);
VALUES (loProcess.Name,loProcess.ProcessID,loProcess.ThreadCount,loProcess.PageFileUsage,;
loProcess.pagefaults,loProcess.WorkingSetSize)
Next
BROWSE normal
FUNCTION terminateProcess(lcProcess)
lcComputer = "."
loWMIService = Getobject("winmgmts:" ;
+ "{impersonationLevel=impersonate}!\\" + lcComputer + "\root\cimv2")
colProcessList = loWMIService.ExecQuery ;
("Select * from Win32_Process")
For Each loProcess In colProcessList
IF UPPER(loProcess.name) = lcProcess
loProcess.terminate()
endif
Next
Note: these will added to an on-growing FAQ.
Mike Gagnon
If you want to get the best response to a question, please check out FAQ184-2483 first.