View Full Version : code to set homepage
i use a vb script that runs when users log on to the domain. is there a way to set the browser homepage with that script?
thanks
i found a way but i cant seem to find the right syntax for it. has to do with editing the registry, specifically HKCU\Software\Microsoft\Internet Explorer\Main\Start Page
if anyone can help
thanks again
I haven't tried this, but I think it would go something like const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "HKCU\Software\Microsoft\Internet Explorer\Main\Start Page"
strValueName = "String Value Name" 'unless it's "Expanded String Value Name"
strValue = "http://www.google.com" 'or whatever homepage url
oReg.SetStringValue _
HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
'or use oReg.SetExpandedStringValue if you use that strValueNameThis is from http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/registry/#CreateStringDword.htm
Also, I have seen some antimalware scanners detect a change in a registry location like this as possible evidence of malware, which you can ignore, as long as it's the value you set it too.
hey thanks for your reply. what is the difference between the expanded string value name and string value name?
yeha i dont know. i dont get any errors but it doesnt change the start page value. i tried stringvaluename and expanded with no errors but no successful output... any ideas??
issue has been solved. thanks again for your reply!
the vb code to set the registry value for start page is
Set Shell = CreateObject( "WScript.Shell" )
Shell.RegWrite "HKCU\SOftware\Microsoft\Internet Explorer\Main\Start Page", "http://www.yahoo.com"
the vb code to set the registry value for start page is
Dim Shell
Set Shell = CreateObject( "WScript.Shell" )
Shell.RegWrite "HKCU\SOftware\Microsoft\Internet Explorer\Main\Start Page", "http://www.yahoo.com"
i forgot the define the variable in my last post. the Dim Shell is what you have to add to the script. I used this as part of my user login script for the domain. It is primarily used for roaming profiles to set the default printers and whatnot in whatever computer lab theyre in at the time.
Glad you got it working. I like using WShell better than winmgmts: objects, but everyone else says it's better so I have trouble finding WShell stuff. The winmgmts: objects don't seem to work for me, either. Thanks for giving the code.
vBulletin® v3.8.3, Copyright ©2000-2010, Jelsoft Enterprises Ltd.