none
How to programmatically manage or set Default Search Providers in IE using PowerShell or vbs

    Question

  • Hi there,

    I was looking to set the default search provider for some of our sites. I can see in the registry where this can be managed, but there seems to be a sort of self-healing behaviour if you just change the value in the HKCU\Software\Microsoft\Internet Explorer\SearchScopres\DefaultScope value. Doing a regshot, this seems to be tied to the HKCU\Software\Microsoft\Internet Explorer\User Preferences values (I'm using Win7, so the one that changes when I manually change providers is 88D7D0879DAB32E14DE583A805A34F98AFF34F5977).

    What I'd like to be able to do is programmatically set this for some of our sites as we deploy to users (without healing or pop ups about a program changing the default search provider). I just want it set once to what we expect it to be (google.com for US sites, google.ca for canadian sites), so doing so through GPO isn't an option. We can use GPP if possible, but I suspect to do it right, we'd need to do it programmatically, so that the "check" values in the registry are filled in properly.

    I ran across this bit of code, the IOpenService::SetDefault, which I believe would do the trick. I'm wondering if this can be converted into PowerShell or vbscript. I guess next question would be what type of code is that example written in?

    

    
    Monday, July 23, 2012 5:06 PM

Answers

  • Seems like I have my workable solution:

    Update the install.ins file and run the StubPath from the IE ActiveSetup registry key for our IEAK 9 Customization. This will reset the user to our default Custom deployment. I'll change the default search provider in the the [SearchProviders] section for the specific country's desired provider and run "RunDLL32 IEDKCS32.DLLL,BrandIE4 CUSTOM" to reimport the settings.

    Kinda cool this command. It updates the settings even if the user has IE open.

    Wednesday, July 25, 2012 9:34 PM

All replies

  • Hi,

    On your computer add the default Search Providers to your IE.....

    then open regedit and export the SearchScopes node.... to a .reg file.... both from the HKCU and HKLM nodes... deploy the .reg file silently with vbs if you like.

    you will notice that the machine default search provider comes from the HKLM/...../SearchScopes node.


    Rob^_^

    Monday, July 23, 2012 7:29 PM
  • With my testing, if you change the DefaultScope to the GUID of the desired Search provider, when you open IE, you'll get the new provider as the default momentarily. Something then changes it back (which you can see in the registry). I've had on one or more occasions had the popup saying that "An unknown program has attempted to change your default search provider". This is not desired and is why I'm looking to do it more programmatically. My suspicion is that the "User Preferences" values store a preference in there or a persistence marker and if things don't add up, it will revert the search provider to the previous default.

    On a related note, if someone out there has some understanding of how to decipher the actual value of the HKCU\Software\Microsoft\Internet Explorer\User Preferences reg_binary values, that would be very handy. I'm not sure if it was deciphered, if it would actually be human readable. I ran the byte array through a few scripts and it doesn't really translate to anything more than what you see from Regedit.

    BTW, the HKLM, HKU\Default, and DefaultUser ntuser.dat settings all only contain Bing. Not the two google values I'm looking to have set. Neither do the ie setup files.

    Monday, July 23, 2012 10:49 PM
  • Use the IEAK Profile Manager to push out your inf updates with the search provider lists and preferences values.... you can also push the reg file with the default search provider lists.

    Tools>Manage Addons>Search Providers>uncheck "Prevent programms suggesting changes to my default search provider". Use RegMon to decipher the preferences key when the above is changed or just include the value in a reg export that you merge into the one .reg file that you push.

    HKLM\......\searchscopes

    contains a list of the default list of search providers that is used to over-write the HKCU key when the user does an IE Reset. The default search provider may or may not be in the HKCU key...


    Rob^_^

    Monday, July 23, 2012 11:10 PM
  • Something then changes it back (which you can see in the registry).

    That sounds like a job for ProcMon.


    ---

    Monday, July 23, 2012 11:10 PM
    Answerer
  • Yeah. the "check" value appears to be is HKCU\Software\Microsoft\Internet Explorer\User Preferences\88D7D0879DAB32E14DE5B3A805A34F98AFF34F5977. You can't export/import this value as something has it locked with an interactive session. You can't delete it or modify it. If you change the DefaultSearchScope before you run IE for the first time on a fresh profile, the change sticks without receiving a prompt as there is another marker value in the registry (HKCU\Software\Microsoft\Internet Explorer\User Preferences\2D53CFFC5C1A3DD2E97B7979AC2A92BD59BC839E81) when you launch IE for the first time. After this point, IE will want to self-heal the Search Provider settings to what they were previously set to. If you change the default in the registry with the above two values set, you will get a prompt from IE saying that something changed your search provider. If you answer this question, another value gets created, which stores your answer and doesn't popup again. It is in the User Preferences key, name is 027C9CB72E593A8F02C55092F385DBAC99DF56D067.

    The setting itself (for us) is specified in the install.ins file we use in the custom folder for IEAK deployment. I've figured out how to make the default in there. All of our other registry and profile entries are default (Bing only). Now, I'm trying to figure out how retrofit the users who are in the states without prompting them that their search engine has changed. If we do it through the registry, I know it will for sure.

    The "Prevent programs from suggesting changes to my search provider" doesn't apply in this situation. It's already unchecked. That popup is IE "health checking" itself after a change has already been incurred.

    It would be nice if someone could chime in on if those registry values can be deciphered and how they might be modified. That's why I was asking above what language was used to write the code in this link that sets the default Search Provider: IOpenService::SetDefault. The funny thing about those values is that even if you mount the ntuser.dat file remotely, those can't be deleted using regedit (maybe another tool??).

    Thanks.

    Wednesday, July 25, 2012 7:24 PM
  • Seems like I have my workable solution:

    Update the install.ins file and run the StubPath from the IE ActiveSetup registry key for our IEAK 9 Customization. This will reset the user to our default Custom deployment. I'll change the default search provider in the the [SearchProviders] section for the specific country's desired provider and run "RunDLL32 IEDKCS32.DLLL,BrandIE4 CUSTOM" to reimport the settings.

    Kinda cool this command. It updates the settings even if the user has IE open.

    Wednesday, July 25, 2012 9:34 PM