code to set homepage

Discussion in 'Software' started by KingSteve, Nov 11, 2008.

  1. KingSteve

    KingSteve MajorGeek

    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
     
  2. KingSteve

    KingSteve MajorGeek

    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
     
  3. PC-XT

    PC-XT Master Sergeant

    I haven't tried this, but I think it would go something like
    Code:
    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 strValueName
    This is from http://www.activexperts.com/activmo.../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.
     
  4. KingSteve

    KingSteve MajorGeek

    hey thanks for your reply. what is the difference between the expanded string value name and string value name?
     
  5. KingSteve

    KingSteve MajorGeek

    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??
     
  6. KingSteve

    KingSteve MajorGeek

    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"
     
  7. KingSteve

    KingSteve MajorGeek


    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.
     
  8. PC-XT

    PC-XT Master Sergeant

    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.
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds