KillAll NonEssential Programs

dmex

ɠɛɐǨ
Vista Guru
Gold Member
This script will kill all programs except the Bare Minimum required for XP or Vista, useful for killing all applications before benchmarking and all or any programs you need killed very quick quick :p

Just add And objProcess.Name <> "name.exe" _ for programs you want whitelisted from the kill ;)

Code:
On Error Resume Next
Dim WshShell, WshFs, objWMIService, colProcessList
Set WshShell = WScript.CreateObject("WScript.Shell")
Set WshFs = CreateObject("Scripting.FileSystemObject")
Set objWMIService = GetObject("winmgmts:root\cimv2")
Set colProcessList = objWMIService.ExecQuery ("Select * from Win32_Process")
' Verify termination executables exist
Set CheckTask = WshFs.GetFile(WshFs.GetSpecialFolder(SystemFolder) & "\system32\taskkill.exe")
Set CheckTs = WshFs.GetFile(WshFs.GetSpecialFolder(SystemFolder) & "\system32\tskill.exe")
Response = MsgBox("Would you like to terminate all non-essential applications?", 36, "Killall")
If Response = "6" Then
For Each objProcess in colProcessList
If objProcess.Name <> "System Idle Process" _
  And objProcess.Name <> "System" _
  And objProcess.Name <> "services.exe" _
  And objProcess.Name <> "winlogon.exe" _
  And objProcess.Name <> "smss.exe" _
  And objProcess.Name <> "csrss.exe" _
  And objProcess.Name <> "lsass.exe" _
  And objProcess.Name <> "alg.exe" _
  And objProcess.Name <> "svchost.exe" _
  And objProcess.Name <> "spoolsv.exe" _
  And objProcess.Name <> "nvsvc32.exe" _
  And objProcess.Name <> "wmiprvse.exe" _
  And objProcess.Name <> "wuauclt.exe" _
  And objProcess.Name <> "explorer.exe" _
  And objProcess.Name <> "wscript.exe" _
  And objProcess.Name <> "cmd.exe" _
  And objProcess.Name <> "taskkill.exe" _
  And objProcess.Name <> "tskill.exe" _
  And objProcess.Name <> "taskmgr.exe" _
Then
If CheckTask <> "" Then
' DEBUG INFO :: MsgBox "TaskKill: " & objProcess.Name
WshShell.Run("taskkill /F /IM " & objProcess.Name & " /T")
End If
If CheckTs <> "" Then
' DEBUG INFO :: MsgBox "TsKill: " & objProcess.Name & "(" & objProcess.ProcessID & ")"
WshShell.Run("tskill " & objProcess.ProcessID & " /A")
End If
' DEBUG INFO :: MsgBox "Terminate: " & objProcess.Name
objProcess.Terminate
End If   
Next
WshShell.Run("shutdown /a")
Else
MsgBox "Application Termination Error...", 48, "Killall"
End If
I have created these two Setup Files for the Tutorials section :cool:


Vista KillAll Setup
download

Vista Sleep Script - http://www.vistax64.com/tutorials/165412-sleep-shortcut.html Installer, Script by sidney1st
download

Programs Screenshot:
attachment.php


Cheers
Steven
 

Attachments

Last edited:

My Computer

Steven,

Does the Sleep option install and uninstall like other install programs?

If so, what does the KillAll option do?

Sorry, running on fumes today. :sleepy:
 

My Computers

System One System Two

  • Operating System
    Windows 10 Pro 64-bit
    Manufacturer/Model
    Custom
    CPU
    Intel i7-8700K 5 GHz
    Motherboard
    ASUS ROG Maximus XI Formula Z390
    Memory
    64 GB (4x16GB) G.SKILL TridentZ RGB DDR4 3600 MHz (F4-3600C18D-32GTZR)
    Graphics card(s)
    ASUS ROG-STRIX-GTX1080TI-O11G-GAMING
    Sound Card
    Integrated Digital Audio (S/PDIF)
    Monitor(s) Displays
    2 x Samsung Odyssey G7 27"
    Screen Resolution
    2560x1440
    Hard Drives
    1TB Samsung 990 PRO M.2, 4TB Samsung 990 PRO PRO M.2, 8TB WD MyCloudEX2Ultra NAS
    PSU
    Seasonic Prime Titanium 850W
    Case
    Thermaltake Core P3
    Cooling
    Corsair Hydro H115i
    Mouse
    Logitech MX Master 3
    Keyboard
    Logitech wireless K800
    Internet Speed
    1 Gb/s Download and 35 Mb/s Upload
    Other Info
    Logitech Z625 speaker system, Logitech BRIO 4K Pro webcam, HP Color LaserJet Pro MFP M477fdn, APC SMART-UPS RT 1000 XL - SURT1000XLI, Galaxy S23 Plus phone
  • Operating System
    Windows 10 Pro
    Manufacturer/Model
    HP Envy Y0F94AV
    CPU
    i7-7500U @ 2.70 GHz
    Memory
    16 GB DDR4-2133
    Sound Card
    Conexant ISST Audio
    Monitor(s) Displays
    17.3" UHD IPS touch
    Screen Resolution
    3480 x 2160
    Hard Drives
    512 GB M.2 SSD
Steven,

Does the Sleep option install and uninstall like other install programs?

If so, what does the KillAll option do?

Sorry, running on fumes today. :sleepy:

Hey Shawn,

Yeah the Sleep Setup creates a desktop and start-menu shortcut for calling Sidney1st`s Sleep Script and installs itself to C:\Program Files\VistaForum\SleepScript ...

The KillAll Setup does exactly the same and also launches the KillAll Script found in C:\Program Files\VistaForum\KillAllScript, its designed to terminate all non-essential programs before benchmarking or playing games.

I have tested both setup files for a variety of different scenarios and I believe they are ready for use and can be installed/uninstalled without issues and can be used from the desktop/start-menu :geek:

Steven
 
Last edited:

My Computer

Thanks for the script mate, just what I was lookin' for.

But I'm havin a few problems..
I was never any good @ .vbs scripts.

But when I run the command script from an elevated command prompt I get a BlueScreen.

The script works like clockwork when I dbl-click on the .vbs file or run in from a normal command prompt.
 

My Computer

Thanks for the script mate, just what I was lookin' for.

But I'm havin a few problems..
I was never any good @ .vbs scripts.

But when I run the command script from an elevated command prompt I get a BlueScreen.

The script works like clockwork when I dbl-click on the .vbs file or run in from a normal command prompt.

If the stop code is 0xC000021A, the script is being too heavy-handed and it results in TerminateProcess() being called against one of the "monitored" system processes without which the OS can't run.
 

My Computer

Thanks for the script mate, just what I was lookin' for.

But I'm havin a few problems..
I was never any good @ .vbs scripts.

But when I run the command script from an elevated command prompt I get a BlueScreen.

The script works like clockwork when I dbl-click on the .vbs file or run in from a normal command prompt.

Yeah it will do that, I originally created it on XP and kinda neglected to update the whitelist for Vista because it would stop the script running on XP :o

Just add these three process's into the script whitelist and it will solve the BSOD you get on Vista when running the script elevated ;)

lsm.exe
csrss.exe
wininit.exe

If the stop code is 0xC000021A, the script is being too heavy-handed and it results in TerminateProcess() being called against one of the "monitored" system processes without which the OS can't run.

The stop-code you get from running the script elevated is 0x000000F4, CRITICAL_OBJECT_TERMINATION ;)
 

My Computer

If the stop code is 0xC000021A, the script is being too heavy-handed and it results in TerminateProcess() being called against one of the "monitored" system processes without which the OS can't run.

The stop-code you get from running the script elevated is 0x000000F4, CRITICAL_OBJECT_TERMINATION ;)

Ah, the difference between unintentional critical process death (0xC000021A) and purposefully blowing off your foot with a shotgun (0xF4). The latter is rare :)
 

My Computer

* bump *

Any help on this one please?
Really like this script; can save one hell of a headache, and save a million n a half hours when workin' on slow corrupted PC's running 100 processes
 

My Computer

* bump *

Any help on this one please?
Really like this script; can save one hell of a headache, and save a million n a half hours when workin' on slow corrupted PC's running 100 processes


The script contains some debug lines to help diagnose issues like this one ;)

You will see a prompt naming each process before its terminated, Just note the name of the process that causes the bluescreen just after you click ok ;)

Where you see these three lines in the script:

' DEBUG INFO :: MsgBox "TaskKill: " & objProcess.Name
' DEBUG INFO :: MsgBox "TsKill: " & objProcess.Name & "(" & objProcess.ProcessID &
' DEBUG INFO :: MsgBox "Terminate: " & objProcess.Name

Change it like so:

' DEBUG INFO ::
MsgBox "TaskKill: " & objProcess.Name
' DEBUG INFO ::
MsgBox "TsKill: " & objProcess.Name & "(" & objProcess.ProcessID &
' DEBUG INFO ::
MsgBox "Terminate: " & objProcess.Name

That will uncomment the lines and allow them to be executed ;)

Then when you run the script it will show a messagebox with the name of the process, once you click OK it will kill that process then show another messagebox with the next process, After you identify what process is casuing the problem just change the two debug lines back to prevent all the message box's from appearing when you rerun the script ;)

Let me know what process is causing the problem and I will update the script here ;)
 

My Computer

Sorry for the late reply..

I got the bluescreen before any dialog boxes appearing, even when changing the 'debug info' lines like you stated previously.

I'm no good @ vbs scripting myself; just started to learn it 2 days ago with WMI.

I was wondeirn' if it would be hard to adapt the script; so that it generates an external vbs script to execute the processes again?

So if I was goin' to play a game, i would use this vbs script here, and it will generate a script to execute the processes again once I finished ( filename based on time/date??.vbs )

Just a thought .. :)
 

My Computer

Back
Top