VBScript – Terminate a specific process




Tagged Under : , , ,

Version: 13.1
Revision: 22 Build 11

VBScript – Terminate a specific process

Introduction:
when I was surfing my website and close “Firefox”, just to clear my temporary files and system caches, the browser’s process was stuck and I have to make a small ‘Vbscript’ to terminate the following process. This can be done by finding its process ID or its application name.

1.] Download notepad++ from the original author or from another source.
——————————-

http://sourceforge.net/projects/notepad-plus/

http://filehippo.com/download_notepad/

——————————-

2.] Copy this ‘VBScript’ source code and save it as “process_terminate.vbs” [without the quotes]. But, you can use other names if you want and keep the extension intact.

Terminate a process application by name.
—Copy Source Code—

strComputer = "."
Set objWMIService = GetObject _
    ("winmgmts:\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
    ("Select * from Win32_Process Where Name = '<name>'")
For Each objProcess in colProcessList
    objProcess.Terminate()
Next

—End Source Code—
Copyright 2001-2009 Lair360


Terminate a process application by id number.
—Copy Source Code—

strComputer = "."
Set objWMIService = GetObject _
    ("winmgmts:\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
    ("Select * from Win32_Process Where ProcessID = <number>")
For Each objProcess in colProcessList
    objProcess.Terminate()
Next

—End Source Code—
Copyright 2001-2009 Lair360


Warning: please use this script carefully!
Any mistake could cause your computer – system to hang, crash or trigger errors.

3.] replace one of the script’s “name” or “number” to terminate a specific process.

4.] Execute the script!

5.] Done!




Windows Process Information




Tagged Under : , , , , ,

Version: 12.7
Revision: 48 Build 45

Windows Process Information

Vista compatible
Windows XP compatible

Introduction: When I am at PCworld, one of the computer technicians lost track of the ProcessID and its file location. So, I took the challenge; boot – up my computer and start creating a VBScript, so that he could track down the process. However, this work took me 3.2 hours to finish! But, there are no worries…they provide me drinks and some food.

After the script creation, the technician found two ‘winlogon.exe’ process and its location.
Thanks to my brilliant script that he was able to track it down and kill it with another tool!!

This script is free for home use and it shall not be for sale! But, if you like this script, please consider a donation…

1.] Download notepad++ from this website.
—————————–

http://www.softpedia.com/get/Office-tools/Text-editors/Notepad-plus-plus.shtml

http://filehippo.com/download_notepad/

2.] Copy one these VBScript to your notepad

3.] Save the script as ‘.vbs’ extension.

Important: Please don’t modify these scripts. They could be very unstable if you change some of the strings. It’s better to leave the codes intact. This is for your own safety.

Notes: This script will record everything and export the information to a file called: Services_Log.rtf (Rich Text Format – Extension)

Windows Process Script
—Copy Source Code—

'-------------------------------------------------
'Author: Lair360
'Version: 13.4
'Revision: 36 Build 45
'This script will collect your process informations and put them
' in an "RTF" - extention file.
'-------------------------------------------------
On Error Resume Next
Set objWMI = _
GetObject("winmgmts:{impersonationLevel=impersonate}\\.\root\cimv2")
Set colProcesses = objWMI.ExecQuery("SELECT * FROM Win32_Process")
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objNewFile = objFS.CreateTextFile("Services_Log.rtf")
objNewFile.WriteLine "Process Report -- Date: " & Now() & vbCrLf
For Each objProcess In colProcesses
objNewFile.WriteLine "Process Name: " & objProcess.Name
objNewFile.WriteLine "OS Creation Class Name: " & objProcess.OSCreationClassName
objNewFile.WriteLine "Process Priority: " & objProcess.Priority
objNewFile.WriteLine "Windows Version: " & objProcess.WindowsVersion
objNewFile.WriteLine "Executable Path: " & objProcess.ExecutablePath
objNewFile.WriteLine "Process CommandLine: " & objProcess.CommandLine
objNewFile.WriteLine "Process ID: " & objProcess.ProcessID
objNewFile.WriteLine "Parents Process ID: " & objProcess.ParentProcessId
objNewFile.WriteLine "Process Session ID: " & objProcess.SessionId
objNewFile.WriteLine "Page File Usage: " & objProcess.PageFileUsage
objNewFile.WriteLine "Peak Page File Usage: " & objProcess.PeakPageFileUsage
objNewFile.WriteLine "Working Set Size: " & objProcess.WorkingSetSize /1024
objNewFile.WriteLine "Page File Size: " & objProcess.PageFileUsage /1024
objNewFile.WriteLine "Virtual Size: " & objProcess.VirtualSize /1024
objNewFile.WriteLine "Handle Count: " & objProcess.HandleCount
objNewFile.WriteLine _
"----------------------------------------------"
objNewFile.WriteLine vbCrLf
Next
objNewFile.Close

—End Source Code—

4.] Activate the script and enjoy!

Copyrighted by Lair360