Jump to content

[How-to] - List Start Up Items


Recommended Posts

Posted (edited)

Here is a VBS Script that will make a HTA, then it will list which programs are configured to automatically run each time Windows starts. This means it will check all Run, RunOnce, RunOnceEx Reg keys in all the registry places, and then it checks in the Alluser, User, start up folder,

Dim Act, Cname, Dtop, Fso, SD, Ts, Uname 
Set Act = CreateObject("Wscript.Shell")
Cname = Act.ExpandEnvironmentStrings("%Computername%")
Uname = Act.ExpandEnvironmentStrings("%Username%")
Dtop = Act.SpecialFolders("Desktop")
SD = Act.ExpandEnvironmentStrings("%Systemdrive%")
Set objWMIService = GetObject("winmgmts:\\" & Cname & "\root\cimv2")
Set colStartupCommands = objWMIService.ExecQuery("Select * from Win32_StartupCommand")
Set Fso = CreateObject("Scripting.FileSystemObject")
Set Ts = Fso.OpenTextFile(Dtop & "\" & Cname & "_ListStartUp.hta",2,True)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''' START OF HTA
Ts.WriteLine "<html xmlns:v=""urn:schemas-microsoft-com:vml"" xmlns:o=""urn:schemas-microsoft-com:office:office"""_
& " xmlns:w=""urn:schemas-microsoft-com:office:word"" xmlns=""http://www.w3.org/TR/REC-html40"">"_
& " <html><head><TITLE>      " & CName &" List Start Up Items</TITLE>"
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''' BODY FOR IT BGCOLOR AND TEXT
Ts.WriteLine "<STYLE>Body.Normal{font:8.75pt;font-family:Palatino-Linotype;color:#006c6c;"_
& " filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#e8e4de', EndColorStr='#5e9ab9')}</STYLE> "
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''' TD BACKGROUND COLOR
Ts.WriteLine " <STYLE> td.Ed1{font:8.75pt;font-family:Palatino-Linotype;color:#000080;filter:progid:DXImageTransform.Microsoft.Gradient"_
& " (GradientType=0,StartColorStr='#e8e4de',endColorStr='#6ba7c6');} </STYLE>"
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''' VBS SCRIPT
Ts.WriteLine " <script language=""vbscript""> window.resizeTo 700,375 : window.MoveTo 55,75" &_
vbCrLf & "</Script>"
Ts.WriteLine " <Body Class=""Normal""> <Table><TD class=""Ed1"" width=""675"" Align=""CENTER"">Script Was Run By, " &_
Uname & "  " & Now() & "</TABLE></TD><BR>"
For Each objStartupCommand in colStartupCommands
Ts.WriteLine " <Table><TD class=""Ed1"" width=""675"" Align=""LEFT"">Command: " & objStartupCommand.Command & "<BR>"
Ts.WriteLine " Description: " & objStartupCommand.Description & "<BR>"
Ts.WriteLine " Location: " & objStartupCommand.Location & "<BR>"
Ts.WriteLine " Name: " & objStartupCommand.Name & "<BR>"
Ts.WriteLine " User: " & objStartupCommand.User & "<BR>"
Ts.WriteLine " </TABLE></TD><BR>"
Next
Ts.Close
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''' RUNS THE HTA ASK TO KEEP OR DELETE
Act.Run(Chr(34) & Dtop & "\" & Cname & "_ListStartUp.hta" & Chr(34)),1,True
ZZ1 = MsgBox(Uname & ", Did You Want To Keep This File?" & vbCrLf & Dtop & "\" & Cname & "_ListStartUp.hta" &_
vbCrLf & vbTab & "Yes To Keep The File" & vbTab & "No to Delete The File", 4 + 32, "Keep Or Delete")
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''' DELETES THE FILE IF USER DOES NOT WANT TO KEEP IT
If ZZ1 = 7 Then Fso.DeleteFile(Dtop & "\" & Cname & "_ListStartUp.hta")
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''' DELETES THE SCRIPT AFTER IT BEEN EXTRACTED FROM THE SFX
If Fso.FileExists(SD & "\ListStartUp_V1.vbs") Then Fso.DeleteFile(SD & "\ListStartUp_V1.vbs")

Title Edited - Please follow new posting rules from now on.

--Zxian

Edited by gunsmokingman

Posted

Good work gunsmokingman. This makes it nice and simple to check what programs are run at startup, and where the possible problem might lie. :)

:thumbup

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...