Remove Your StartUp Items from the MSconfig menu. (VBScript)

'Removes Unchecked StartUp Items from StartUp Msconfig

On Error Resume Next
Message = "This script will remove unchecked items from the MSConfig menu." & vbCr &vbCr
Message = Message & "Continue?"

X = MsgBox(Message, vbYesNo + vbQuestion, "Paul's XP and Vista Tweaks")
If X = 6 Then

Set sh = WScript.CreateObject("WScript.Shell")

Set pm = WScript.CreateObject("WScript.Shell")

Set pReg = GetObject("winmgmts:!root/default:StdRegProv")
Const HKLM = &H80000002
RegKeyPHM = "Software\Microsoft\Shared Tools\MSConfig\startupfolder"
RegKeyJAM = "Software\Microsoft\Shared Tools\MSConfig\startupreg"

ResultsPHM = EnumKey(HKLM, RegKeyPHM, False)
If ResultsPHM = "" Then
ResultsPHM = space(5) & "(NONE)"
pBtns = 0

Else

pBtns = 4
pDelPrompt = "Would you like to DELETE any of these items?"

End If

pResults = "Disabled items in Your Startup Folder:" & vbcrlf & _
ResultsPHM & vbcrlf & vbcrlf

ResultsJAM = EnumKey(HKLM, RegKeyJAM, False)
If ResultsJAM = "" Then
ResultsJAM = space(5) & "(NONE)"
If pBtns <> 4 Then pBtns = 0

Else

pBtns = 4
pDelPrompt = "Would you like to DELETE any of these items?"

End If

pResults = pResults & "Disabled items in Startup Reg Keys:" & vbcrlf & _
ResultsJAM & vbcrlf & vbcrlf
If MsgBox(pResults & pDelPrompt, pBtns + 256, "Don't forget to uncheck your StartUp items in Msconfig. ") <> 6 Then WScript.quit

EnumKey HKLM, RegKeyJAM, True
EnumKey HKLM, RegKeyPHM, True

Function EnumKey(Key, SubKey, pDelete)
Dim Ret()
pReg.EnumKey Key, SubKey, pKeys

On Error Resume Next

ReDim Ret(UBound(pKeys))
If Err = 13 Then Exit Function

On Error GoTo 0

For Count = 0 to UBound(pKeys)
If Not pDelete Then

Ret(Count) = space(5) & pKeys(Count)

Else

If MsgBox("Would You Like to DELETE this Item? "& vbcrlf & _
pKeys(Count) & "?" & vbcrlf, 4 + 256 , "This Item Can Be Deleted") = 6 Then
DeleteKey HKLM, SubKey & "\" & pKeys(Count)

End If

End If

Next

EnumKey = Join(Ret, vbcrlf)

End Function

Function DeleteKey(Key, SubKey)
DeleteKey = pReg.DeleteKey(Key, SubKey)

End Function
End If

Download


Back to Line 4