View Single Post
Old 10-10-2008   #1 (permalink)
Smoreno


 
 

How to terminate a Win32 process without using "winmgmts:"

Hello,

I use the following script to terminate the process listed in it. As the
server gets loaded killing the process (terminate()) takes longer as the load
increases. The WMI service takes longer find and kill the process.

Other than calling WMI, is there another way to kill the process via script
that doesn't take a long time?

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'pcsws.exe'")
For Each objProcess in colProcessList
colProperties = objProcess.GetOwner(strNameOfUser)
If strusername = strnameofuser Then
objProcess.Terminate()
Else
End If
Next
--
Smoreno - ADOT
My System SpecsSystem Spec