Kae Travis

Configuring Google Chrome 49.0.2623.112

I’ve been configuring Google Chrome 49.0.2623.112 recently using the Enterprise installer (googlechromestandaloneenterprise.msi), for a legacy Windows XP environment.

Anyway, here’s my recipe.

We have manually created a master.preferences file:

{
"session": {
    "restore_on_startup": 4,
    "startup_urls": [
    "http://www.yourhomepage.co.uk/"
    ]
},
"browser": {
    "show_home_button": true,
    "check_default_browser": false
},
"distribution": {
    "show_welcome_page": false,
    "skip_first_run_ui": true,
    "import_bookmarks": false,
    "import_history": false,
    "import_home_page": false,
    "import_search_engine": false,
    "suppress_first_run_bubble": true,
    "do_not_create_desktop_shortcut": true,
    "do_not_create_quick_launch_shortcut": true,
    "do_not_create_taskbar_shortcut": true,
    "do_not_launch_chrome": true,
    "do_not_register_for_update_launch": true,
    "make_chrome_default": false,
    "make_chrome_default_for_user": false,
    "require_eula": false,
    "suppress_first_run_default_browser_prompt": true,
    "system_level": true,
    "verbose_logging": true
},
"first_run_tabs": [
    "http://www.yourhomepage.co.uk/"
],
"homepage": "http://www.yourhomepage.co.uk/",
"homepage_is_newtabpage": false,
"sync_promo": {
    "show_on_first_run_allowed": false
}
}

Most of the entries are self explanatory.  However Google Chrome doesn’t open on the homepage when you launch the browser – instead it opens on the Startup URL, so we configured this to point to the ‘homepage’ too.

A guide for preferences can be found here:

http://www.chromium.org/administrators/configuring-other-preferences

The content of this file is in JSON format. Once you have finished editing and tweaking, ensure the JSON validates successfully – you can do this here: http://jsonlint.com/

Now we will add these ‘master preferences’ to our installer.  To do this we URL Encode the content of master.preferences file. You can do this in any URL Encoding/Decoding website such as here: http://meyerweb.com/eric/tools/dencoder/

Create a transform (MST)

Create a Property called MASTER_PREFERENCES. Paste the URL encoded master_preferences into the value field.

Find the Custom Action called BuildInstallCommand.   Look in the Target column and set: installerdata=[MASTER_PREFERENCES]

This will generate your master.preferences file at install time so that any new user profile created when Google Chrome is launched will use these settings (existing profiles will not use this preferences file). When Google Chrome is launched for the first time, user data is created here:

[LocalAppDataFolder]\Google\Chrome\User Data

I’ve also added a VBScript custom action to run towards the end of the InstallExecuteSequence (Deferred, just before InstallFinalize) to delete C:\Program Files\Google\Update and delete the services gupdate and gupdatem. This will suppress Chrome from updating.  The condition for this custom action is NOT REMOVE~=”ALL”.

On Error Resume Next

dim wshShell : Set wshShell = CreateObject("WScript.Shell")
dim fso : Set fso = CreateObject("Scripting.FileSystemObject")

dim pFiles : pFiles = wshShell.ExpandEnvironmentStrings("%PROGRAMFILES%")
dim folderToDelete : folderToDelete = pFiles & "\Google\Update"

'kill update service
wshShell.run "SC DELETE gupdate",0,true
wshShell.run "SC DELETE gupdatem",0,true

'kill update process if exists (otherwise we cannot delete Updates folder)
dim processArray  : processArray = Array("GoogleUpdate.exe")
dim process
For Each process In processArray  
	wshShell.run "TASKKILL /im " & chr(34) & process & chr(34) &  " /f /t", 0, true
Next

'have 10 attempts at deleting the file - just in case of timing issues!
Dim loopCount : loopCount = 0
Do While fso.FolderExists(folderToDelete) And loopCount < 10 
       fso.DeleteFolder folderToDelete, true 
       sleep1 1 
       loopCount = loopCount + 1 
Loop Set 

wshShell = Nothing 
Set fso = Nothing 

Sub sleep1(strSeconds) 
       Dim dteWait : dteWait = DateAdd("s", strSeconds, Now()) 
       Do Until (Now() > dteWait)
       Loop
End Sub

Note that to sleep from within a custom action, we use one of the appraches mentioned here.

I’ve also added a clean up script after uninstall since it sometimes leaves a folder called CrashReports behind:

On Error Resume Next

dim wshShell : Set wshShell = CreateObject("WScript.Shell")
dim fso : Set fso = CreateObject("Scripting.FileSystemObject")

dim pFiles : pFiles = wshShell.ExpandEnvironmentStrings("%PROGRAMFILES%")
dim folderToDelete : folderToDelete = pFiles & "\Google\CrashReports"

If fso.FolderExists(folderToDelete) Then 
	fso.DeleteFolder folderToDelete, true
End If 

'Delete Google folder if empty

folderToDelete = pFiles & "\Google"

If fso.FolderExists(folderToDelete) Then
 
	Dim objFolder : Set objFolder = fso.GetFolder(folderToDelete)
	 
	If objFolder.Files.Count = 0 And objFolder.SubFolders.Count = 0 Then
		objFolder.Delete(true)
	End If
 
End If
 
Set wshShell = Nothing
Set fso = Nothing

 

Configuring Google Chrome 49.0.2623.112
Configuring Google Chrome 49.0.2623.112

Leave a Reply