CleanupStartup

Table of Contents

Here again with another script, this time to clean-up what runs on a computer.
Can kill off start-up entries, services and tasks.
Tasks only works from vista and above as I don’t have a XP machine to play around on.

Anyways, just add to the array the names of the programs you want removed.
Here are a few ive found but be sure to let me know which ones you add to the list so I can keep it updated.

Thanks! 🙂

Dim RemoveStartups, RemoveTasks, DisableServices, objWMIService, WshShell
Set WshShell = CreateObject("WScript.Shell")

'Change your programs here
RemoveStartups = Array("Dell Registration","Adobe Reader Speed Launcher","SunJavaUpdateScged","Switchboard","AdobeCS6ServiceManager","AdobeCS5ServiceManager","AdobeCS4ServiceManager","AdobeAAMUpdater-1.0","AdobeARM","UpdReg","RoxWatchTray","Desktop Disc Tool","ATICustomerCare","QuickTime Task","iTunesHelper","Google Update","IAStorIcon")
RemoveTasks = Array("AdobeAAMUpdater-1.0","GoogleUpdateTaskUser", "Adobe Flash Player Updater")
DisableServices = Array("AdobeARMservice","AdobeFlashPlayerUpdateSvc","SwitchBoard")

'Dont Modify Below this

For Each Item in RemoveStartups
	DeleteStartup(Item)
Next

WScript.Echo " "

For Each Item in RemoveTasks
	DeleteScheduledTask(Item)
Next

WScript.Echo " "

For Each Item in DisableServices
	DisableService(Item)
Next

WScript.Echo " "

ShowStartupItems()
WScript.Echo " "
ShowScheduledTasks()

Sub DisableService(strName)
	strComputer = "."
	Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

	Set colServiceList = objWMIService.ExecQuery("Select * from Win32_Service where Name = '" & strName & "'")

	For Each objService in colServiceList
		If objService.State = "Running" Then
			objService.StopService()
			Wscript.Sleep 5000
		End If
		errReturnCode = objService.ChangeStartMode("Disabled")   
		WScript.Echo "Disabled Service: " & strName
	Next
End Sub

Sub DeleteStartup(strName)
	If KeyExists(strKey & strName) Then 
		WshShell.RegDelete strKey & strName
		WScript.Echo "Removing Startup: " & strName
	End If
	
	If KeyExists(strKey64 & strName) Then 
		WshShell.RegDelete strKey64 & strName
		WScript.Echo "Removing Startup: " & strName
	End If
End Sub

Sub DeleteScheduledTask(strName)
' Create the TaskService object.
Set service = CreateObject("Schedule.Service")
call service.Connect()

' Get the task folder that contains the tasks. 
Dim rootFolder
Set rootFolder = service.GetFolder("\")
 
Dim taskCollection
Set taskCollection = rootFolder.GetTasks(0)

    Dim registeredTask
	
    For Each registeredTask In taskCollection
		If instr(registeredTask.Name, strName)  0 then
			rootFolder.DeleteTask registeredTask.Name, 0 
			WScript.Echo "Deleted Task: " & registeredTask.Name
		End If
    Next
End Sub

Function KeyExists(strKey)
	On Error Resume Next 
	WshShell.RegRead(strKey)
	bFound = (err.number = 0) 
	On Error Goto 0 
	
	If bFound then
		KeyExists = True
	Else
		KeyExists = False
	End if
End Function

Sub ShowStartupItems()
	'------------------------------------------------------------------------------- 
	'Display startup program list. 
	'By: Umesh C. Thakur (ucthakur@hotmail.com) 
	'------------------------------------------------------------------------------- 
	dim strKey, strComputer, oReg, strKeyValue 
	const HKEY_LOCAL_MACHINE = &H80000002 
	strKey="SOFTWARE\Microsoft\Windows\CurrentVersion\Run" 
	strComputer = "." 
	  
	Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv") 
	oReg.EnumValues HKEY_LOCAL_MACHINE, strKey,arrValueNames 
	 
	'List header 
	wscript.echo "PROGRAM NAME" & vbTab & vbTab & "PROGRAM PATH" 
	wscript.echo "------------" & vbTab & vbTab & "---------------------------------" 
	 
	'Loop through all programs, display their name and path. 
	For i = 0 To UBound(arrValueNames) 
		oReg.GetStringValue HKEY_LOCAL_MACHINE, strKey, arrValueNames(i), strKeyValue 
		wscript.echo arrValueNames(i) & vbTab & vbTab & strKeyValue 
	Next 
End Sub

Sub ShowScheduledTasks()
	WScript.Echo "Registed Tasks"
	WScript.Echo "-----------------"
	' Create the TaskService object.
	Set service = CreateObject("Schedule.Service")
	call service.Connect()

	' Get the task folder that contains the tasks. 
	Dim rootFolder
	Set rootFolder = service.GetFolder("\")
	 
	Dim taskCollection
	Set taskCollection = rootFolder.GetTasks(0)

	Dim numberOfTasks
	numberOfTasks = taskCollection.Count

	If numberOfTasks = 0 Then 
		Wscript.Echo "No tasks are registered."
	Else
	   
		Dim registeredTask
		For Each registeredTask In taskCollection
			WScript.Echo "Task Name: " & registeredTask.Name
		Next
	End If
End Sub

Our Services