Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Vista Forums > Software

Vista - KillAll NonEssential Programs

Reply
 
Old 06-25-2008   #1 (permalink)


Windows Vista™ Ultimate
 
 

KillAll NonEssential Programs

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

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


Vista KillAll Setup


Vista Sleep Script - Sleep Shortcut Installer, Script by sidney1st


Programs Screenshot:


Cheers
Steven

Attached Thumbnails
screenshot.jpg  
Attached Files
File Type: zip Vista KillAll.zip (39.8 KB, 277 views)
File Type: zip Vista Sleep.zip (35.6 KB, 49 views)

Last edited by dmex; 08-09-2008 at 01:46 PM..
My System SpecsSystem Spec
Old 07-09-2008   #2 (permalink)


Vista x64 Ultimate SP2, Windows 7 Ultimate x64
 
 

re: KillAll NonEssential Programs

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.
My System SpecsSystem Spec
Old 07-09-2008   #3 (permalink)


Windows Vista™ Ultimate
 
 

re: KillAll NonEssential Programs

Quote  Quote: Originally Posted by Brink View Post
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.
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

Steven

Last edited by dmex; 07-28-2008 at 12:10 AM..
My System SpecsSystem Spec
Old 05-13-2009   #4 (permalink)


Vista Home Basic Service Pack 1 32bit
 
 

Re: KillAll NonEssential Programs

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 System SpecsSystem Spec
Old 05-13-2009   #5 (permalink)


Win7x64
 
 

Re: KillAll NonEssential Programs

Quote  Quote: Originally Posted by Methical View Post
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 System SpecsSystem Spec
Old 05-13-2009   #6 (permalink)


Windows Vista™ Ultimate
 
 

Re: KillAll NonEssential Programs

Quote  Quote: Originally Posted by Methical View Post
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

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

Quote  Quote: Originally Posted by H2SO4 View Post
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 System SpecsSystem Spec
Old 05-13-2009   #7 (permalink)


Win7x64
 
 

Re: KillAll NonEssential Programs

Quote  Quote: Originally Posted by dmex View Post
Quote  Quote: Originally Posted by H2SO4 View Post
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 System SpecsSystem Spec
Old 05-13-2009   #8 (permalink)


Vista Home Basic Service Pack 1 32bit
 
 

Re: KillAll NonEssential Programs

Quote  Quote: Originally Posted by dmex View Post
The stop-code you get from running the script elevated is 0x000000F4, CRITICAL_OBJECT_TERMINATION
Yup, that is the error that I get, even after adding those other 3 processes you told me to add.
My System SpecsSystem Spec
Old 05-24-2009   #9 (permalink)


Vista Home Basic Service Pack 1 32bit
 
 

Re: KillAll NonEssential Programs

* 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 System SpecsSystem Spec
Old 05-25-2009   #10 (permalink)


Windows Vista™ Ultimate
 
 

Re: KillAll NonEssential Programs

Quote  Quote: Originally Posted by Methical View Post
* 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 System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Programs not appearing at Start/All Programs General Discussion
Help! Vista Premium x64 suddenly not loading programs on startup and no programs run! General Discussion
Uninstalling Programs not in Windows Features or Programs & Featur Vista General
Adding new programs to Default Programs list Vista General
uninstalling programs that are not listed in programs and features Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46