May 18, 2010

Posted by in Tech Tips | 17 Comments

Vista / Windows 7 Custom Google Search Engine Policy (IE7 / IE8)

For quite some time now one of the most popular posts on this site has been my Google search group policy item that I wrote for IE 7 on Windows XP. I thought it was probably about time to bring this up-to-date and refresh it with a policy suitable for both IE7 and IE8 on Windows Vista or Windows 7.

One of the main challenges was the fact that Microsoft have removed the .ADM file format and replaced with with two XML based definition files. Each policy definition is now split into a .admx and an .adml file. The idea is that the admx contains the configuration information and the adml provides the language definitions (i.e what is displayed in the policy editor window). This now means it is very simple to localise the policies if required.

The policy that I have created is for the Google.com search engine and includes the auto complete function so that as you type it will make guesses about your search terms. It should be very easy to modify the policy to use a different search engine if required and I will do a follow up post that runs through how to create your own search policy.

This policy also allows you to specify the search settings at either a user or machine basis depending on what you require

Populate_IE_search.admx – the policy definition file (Download)

<?xml version="1.0" encoding="utf-8"?>
<policyDefinitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.0" schemaVersion="1.0" xmlns="http://www.microsoft.com/GroupPolicy/PolicyDefinitions">
	<policyNamespaces>
		<target prefix="search" namespace="Microsoft.Policies.search" />
		<using prefix="inetres" namespace="Microsoft.Policies.InternetExplorer" />
	</policyNamespaces>
	<resources minRequiredRevision="1.0" />
	<supportedOn>
		<definitions>
			<!--At least Internet Explorer 7.0 and Windows Vista upwards -->
			<definition name="SUPPORTED_IE7VISTAUP" displayName="$(string.SUPPORTED_IE7VISTAUP)">
				<and>
					<range ref="products:InternetExplorer" minVersionIndex="7"/>
					<range ref="products:MicrosoftWindows" minVersionIndex="6"/>
				</and>
			</definition>
		</definitions>
	</supportedOn>
	<policies>
		<policy name="PopulateSearchProviderList_1" class="User" displayName="$(string.PopulateSearchProviderList)" explainText="$(string.IE_Explain_PopulateSearchProviderList)"  key="Software\Policies\Microsoft\Internet Explorer\SearchScopes">
			<parentCategory ref="inetres:InternetExplorer" />
			<supportedOn ref="inetres:SUPPORTED_IE7Vista"/>
			<enabledList>
				<item key="Software\Policies\Microsoft\Internet Explorer\SearchScopes" valueName="Version">
					<value>
						<decimal value="1" />
					</value>
				</item>
				<item key="Software\Policies\Microsoft\Internet Explorer\SearchScopes\Google_com" valueName="DisplayName">
					<value>
						<string>Google</string>
					</value>	
				</item>	
				<item key="Software\Policies\Microsoft\Internet Explorer\SearchScopes\Google_com" valueName="URL">
					<value>
						<string>http://www.google.com/search?q={searchTerms}&amp;rls=com.microsoft:{language}&amp;ie={inputEncoding}&amp;oe={outputEncoding}&amp;startIndex={startIndex?}&amp;startPage={startPage}</string>
					</value>
				</item>
				<item key="Software\Policies\Microsoft\Internet Explorer\SearchScopes\Google_com" valueName="FaviconURL">
					<value>
						<string>http://www.google.com/favicon.ico</string>
					</value>
				</item>				
				<item key="Software\Policies\Microsoft\Internet Explorer\SearchScopes\Google_com" valueName="SuggestionsURL">
					<value>
						<string>http://clients5.google.com/complete/search?q={searchTerms}&amp;client=ie8&amp;mw={ie:maxWidth}&amp;sh={ie:sectionHeight}&amp;rh={ie:rowHeight}&amp;inputencoding={inputEncoding}&amp;outputencoding={outputEncoding}</string>
					</value>
				</item>
			</enabledList>
		</policy>
		<policy name="PopulateSearchProviderList_2" class="Machine" displayName="$(string.PopulateSearchProviderList)" explainText="$(string.IE_Explain_PopulateSearchProviderList)" key="Software\Policies\Microsoft\Internet Explorer\SearchScopes">
			<parentCategory ref="inetres:InternetExplorer" />
			<supportedOn ref="inetres:SUPPORTED_IE7Vista"/>
			<enabledList>
				<item key="Software\Policies\Microsoft\Internet Explorer\SearchScopes" valueName="Version">
					<value>
						<decimal value="1" />
					</value>
				</item>
				<item key="Software\Policies\Microsoft\Internet Explorer\SearchScopes\Google_com" valueName="DisplayName">
					<value>
						<string>Google</string>
					</value>	
				</item>	
				<item key="Software\Policies\Microsoft\Internet Explorer\SearchScopes\Google_com" valueName="URL">
					<value>
						<string>http://www.google.com/search?q={searchTerms}&amp;rls=com.microsoft:{language}&amp;ie={inputEncoding}&amp;oe={outputEncoding}&amp;startIndex={startIndex?}&amp;startPage={startPage}</string>
					</value>
				</item>
				<item key="Software\Policies\Microsoft\Internet Explorer\SearchScopes\Google_com" valueName="FaviconURL">
					<value>
						<string>http://www.google.com/favicon.ico</string>
					</value>
				</item>				
				<item key="Software\Policies\Microsoft\Internet Explorer\SearchScopes\Google_com" valueName="SuggestionsURL">
					<value>
						<string>http://clients5.google.com/complete/search?q={searchTerms}&amp;client=ie8&amp;mw={ie:maxWidth}&amp;sh={ie:sectionHeight}&amp;rh={ie:rowHeight}&amp;inputencoding={inputEncoding}&amp;outputencoding={outputEncoding}</string>
					</value>
				</item>
			</enabledList>
		</policy> 
	</policies>
</policyDefinitions>

Populate_IE_search.adml – the policy language definition file (Download)

<?xml version="1.0" encoding="utf-8"?>
<policyDefinitionResources xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.0" schemaVersion="1.0" xmlns="http://www.microsoft.com/GroupPolicy/PolicyDefinitions">
  <displayName>IE8 Search Policy</displayName>
  <description>Add Google to the search box for IE7 or IE 8</description>
  <resources>
    <stringTable>
	<string id="SUPPORTED_IE7VISTAUP">Windows Vista with IE 7 and upwards</string>
      <string id="PopulateSearchProviderList">Populate List of Search Providers</string>
      <string id="IE_Explain_PopulateSearchProviderList">This policy setting will let you populate a list of search providers that will be displayed in Internet Explorer's search box.
 
If you enable this policy setting and if the "Restrict search providers to a specific list of search providers" Group Policy setting is enabled, this list will be the only list that appears in the Internet Explorer drop-down list. If the "Add a specific list of search providers to the user's search provider list" Group Policy setting is enabled, this list will be added to the user's list of search providers.
 
If you disable this policy setting or do not configure it, users will have complete freedom to create their own search provider list.</string>
    </stringTable>
  </resources>
</policyDefinitionResources>

To test these out locally copy the files to the following location:

admx: %windir%\PolicyDefinitions

adml: %windir%\PolicyDefinitions\en-US

You should then be able to open gpedit.msc and browse to:

(user or computer configuration)\Administrative Templates\Windows Components\Internet Explorer\

The setting is called “Populate List of Search Providers

image

It is important that when you enable this policy it will not work on its own! You have to make a choice about how to implement your additional search providers.

If you only want users to have the search provider specified in the policy then you need to enable the “Restrict search providers to a specific list of providers” policy as well.

image Restricted to just the policy provider

If you want to allow users to customise their provider list or be allowed to add more then you need to enable “Add a specific list of search providers to the user’s search provider list”.

image

Added but user customisable

It is very important that one or the other of these extra settings is enabled otherwise you wont see your custom search provider.

To implement this on a domain in a proper group policy you will need to copy the admx/l files to the domain “Central Store” and then you can include them in a domain policy. For more information about the Central Store have a look here:

http://technet.microsoft.com/en-us/library/cc748955%28WS.10%29.aspx

As I said I’ll do a follow up post that runs through how to create your own custom search policy for as many providers as you want or using localised versions of your favourite search engine. In the mean time, let me know how you get on!

  1. Thank you! It worked perfect. I cant wait for the extended list of providers admx and adml files. I could hug you.

  2. I love you. Deeply. Truly.

    For this AND for the IE7 in WinXP .adm file.

  3. But how to make Google the default?

  4. Hello Emvy,
    If you use the “restrict search provider list” then it should make what you specified as the default, I take it you want users to still have a choice but to make the custom search the default?

    Ben

  5. Great Post. I am also having issues with defaulting. I would like to leave the users able to pick their search provider. I tried your suggestion of “restrict search provider” but for some reason I still get bing as my default search provider. I check the registry HKEY_CURRENT_USERS\Software\Policies\Microsoft\Internet Explorer\Search Scopes\ and there is a DefaultScope string setting to google_com however it is not honored. It defaults to bing. Which if you look at HKEY_CURRENT_USERS\Software\Microsoft\Internet Explorer\Search Scopes\ I see the defualtscope is set to a GUID which points to a bing installation that I did not define in my policy. Here is a copy of my policy as well.

    Edit by Ben: code mangled as it got posted so i removed it

  6. Hello Howard,
    Thanks for your comment. The code got mangled so I removed that part of it.

    The ability to set a default search engine if you’re not forcing a single provider is a bit tricky.
    The registry key required cannot be set via a “policy” setting but has to be a “preference” this means that instead of going in the registry as HKCU\Software\Policy\ it goes in the normal registry location. A preference also does not get “removed” if the Group Policy is removed from a user.

    The key that needs changing is “HKCU\Software\Microsoft\Internet Explorer\SearchScopes” then the REG_SZ entry called “DefaultScope”. This entry should match whatever the name of the search scope you created is…

    I can have a look at describing how you would do this if you get stuck?

    Ben

  7. If I make that setting wouldn’t it permanetly make the setting. I.E. THe use may be allowed to change it for a session but on next logon it would reset back to whatever the policy has?

  8. The “preference” options (not true Group Policy preferences as you find in server 2008) will apply once and then only if the policy changes or is modified. This isn’t ideal but is the only way I can think of doing it in a traditional policy without resorting to scripts of some kind… The default search policy is I think re-populated from the HKLM key so there might be a way to do something about deleting the HKCU key and letting it get pulled from the HKLM that you’ve changed. That way any policy changes wouldn’t affect the user preference.
    I’ll have at think and an experiment and see if I can get anywhere…
    Ben

  9. Matt Falcon says:

    Hm… IE7 + Windows XP = Server 2003 .adm file (although you might want to check that old blog post; the code section is totally mangled and unusable in Chrome). But IE8 + Windows 7 = Server 2008 .admx file?

    We’re using Server 2003 here and working on a plan to migrate clients from XP to Windows 7 x64. Still using Server 2003, hence .adm files. I’ve had no luck trying to find a admx to adm converter (only adm to admx). I’ll probably have it resolved by the time you read this, but perhaps other users could benefit from an .adm version of this policy as well? 🙂

  10. Hoping for some late help on this, I’ve applied this GPO but the only thing that gets created are the keys beneath SearchScopes, nothing else is populated when I click on the newly created key. Thoughts?

  11. You are the man!!! this saved me alott of work man ;-)…thank you.

  12. Great work, thanks a lot!

  13. It works great! But in addition I had to rename the files after I took “Save target as…”

    Thank you very much indeed!

  14. How can I put more than one searchprovider in one list? I want to make a admx/aml which puts google and bing in the search provider list.

  15. One thing that’s not working is the search suggestions that is unavailable for google. Is like missing ShowSearchSuggestions (Reg_DWORD) in the admx file. I’m trying to add it, but not familiar with xml code.

  16. Anyone else having the issue that if you enable to “Restrict search providers to a specific list of providers” policy, the user gets an error “This operation has been cancelled due to restrictions in effect on this computer.”? The user is able to click OK, then click Set as Default (which gives the same error 2 more times) and the default is changed. Trying to get rid of these annoying errors!

  17. Rob Nicholson says:

    Why are there two policies in there?

    PopulateSearchProviderList_1
    PopulateSearchProviderList_2

    They appear to be identical?

    Cheers, Rob.

Trackbacks/Pingbacks

  1. Customize IE8 through Group Policy | Concurrency, Inc. - [...] had a client ask me how to set the default search engine and I found Ben’s blog post. There…
  2. Where to download .ADM or .ADMX file to setup default search providers within Windows 2008 R2 for Internet Explorer 8? - Just just easy answers - […] blog post is one of the better resources I’ve come across. It provides a great overview, downloadable […]

Leave a Reply

Your email address will not be published. Required fields are marked *