Let’s terminate a program (.vbs)

Sometimes we may need to terminate a Program with .vbs , which is unavoidable in some cases if you are usually making small size programs , however in such cases you can use
the following .vbs code

Option Explicit Dim objWMIService, objProcess, colProcess Dim strComputer, strProcessKill strComputer = “.” strProcessKill = “‘msnmsgr.exe'” Set objWMIService = GetObject(“winmgmts:” _ & “{impersonationLevel=impersonate}!\” _ & strComputer & ”
ootcimv2″) Set colProcess = objWMIService.ExecQuery _ (” Select * from Win32_Process Where Name = ” & strProcessKill ) For Each objProcess in colProcess objProcess.Terminate() Next WSCript.Echo “Just killed process ” & strProcessKill _ & ” on ” & strComputer WScript.Quit ‘ End of WMI Example of a Kill Process

or

strComputer = “.” strProcessToKill = “msnmsgr.exe” Set objWMIService = GetObject(“winmgmts:” _ & “{impersonationLevel=impersonate}!\” _ & strComputer & ”
ootcimv2″) Set colProcess = objWMIService.ExecQuery _ (“Select * from Win32_Process Where Name = ‘” & strProcessToKill & “‘”) count = 0 For Each objProcess in colProcess objProcess.Terminate() count = count + 1 Next

In our example above, the messenger (msnmsgr.exe) has been terminated, you can replace it with whatever you want. You can write the exe of another software. Paste these codes in a notepad and click File – Save As… and save the extension as .bat/.vbs… and run

Velociraptor

Leave a Reply

Your email address will not be published. Required fields are marked *