Link to home
Start Free TrialLog in
Avatar of martman2002uk
martman2002uk

asked on

Killing SYSTEM Processes Using A VBS File

Hello

im trying to make a VBS file that will end a list of process, so far using the web i have made a VBS file, the first part of which is listed belowe
----------------------------------------------------------------------------------------------------------------------------
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
    ("Select * from Win32_Process Where Name = 'ati2evxx.exe'")
For Each objProcess in colProcessList
    objProcess.Terminate()
Next
Set colProcessList = objWMIService.ExecQuery _
    ("Select * from Win32_Process Where Name = 'LVPrcSrv.exe'")
For Each objProcess in colProcessList
    objProcess.Terminate()
Next
----------------------------------------------------------------------------------------------------------------------------

i have all the processes i want to end in this file, but it seems as if the VBS file doesnt end any process that are not running under my username

is there a way i can make the VBS file end all the processes in the VBS file no matter who is running it

any hepl is a plus, thanks.
Avatar of amit_g
amit_g
Flag of United States of America image

If you are not administrator, you can't terminate process run by other users regardless of what method you use. Also some processes e.g. service can't be terminated this way.
Avatar of martman2002uk
martman2002uk

ASKER

i am on the computer as adminstrator and from what i gather...

impersonationLevel=impersonate

means the VBS file will run as if it was me, but i can end SYSTEM processes, how come the VBS file wont ? and is there a way to end services with a VBS script that i can add to the end of this VBS file
SOLUTION
Avatar of amit_g
amit_g
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
wouldn't this be done easier just using a batch file?

taskkill.exe /im ati2evxx.exe

just a thought
Well it depends on which one gets the job done, so far some of the batch files i have made and used do not work.

on closer look of the processes i have running and want to end, i've come to the conclusion that they are services, is there a VB way to end/stop a service? without stopping it from running at next boot up?
net stop <service>

use a batch,.. there is no reason not to,.
if you want to do it at a specific time, use task scheduler
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
@amit g
is there a way to stop the service by filename, such as ati2evxx.exe ?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
oops,. forgot to dim colListOfServices2
Change

("Select * from Win32_Service where Caption = 'Symantec AntiVirus'")

to

("Select * from Win32_Service where PathName = 'C:\\WINNT\\system32\\Ati2evxx.exe'")

You will have to give full path with \ escaped.