In a previous article,
I discussed the three options available for deploying and managing Google Chrome
in a business setting:

  1. You can push out a standard Chrome install file and
    implement the desired settings for Windows systems via Group Policy using custom
    ADM/ADMX templates. This is recommended for companies running Active Directory.
  2. You can push out a standard Chrome install file and
    implement the desired settings for Windows systems via a master preferences file
    copied to each computer. This is recommended for companies without Active Directory.
  3. You can configure Chrome user policies/extensions
    (known as cloud policies) for Google Apps users via your Admin Console. These will
    apply to any Chrome user who signs into their Google Apps account; no special install
    file will be needed. This will work whether you have Active Directory or not; the
    focus here is administration from the Google Apps side.

This article is the second of three and will focus on option
#2 above: installing the Chrome browser on Windows systems using the “Chrome
for Business” installer provided by Google and configuring options using a
master preferences file. The final article will cover options #3, so please watch
for the upcoming conclusion if this is a concept that interests you.

Master preferences file

Why would you want to use a master preferences file to configure
Chrome for users? As stated, this is the best option for rolling out Chrome to Windows
systems if your company doesn’t run Active Directory. This process also lets you
configure settings for non-domain computers such as home PCs, and getting familiar
with the practice can assist you in setting up Chrome for Linux systems, which also
uses a master preferences file.

The master preferences file contains the default settings which
users will receive (such as the home page for instance). When any user on the target
system starts Chrome for the first time it will use this file to configure the desired
options; it will then do the same for all subsequent users. The preference file
import only runs once per user, so, it’s important to make the settings count. It
should also be pointed out that users will be able to change the preferences after
Chrome starts up; this does not enact mandatory settings.

Removing prior versions of Chrome

(Skip down to “Download
the Chrome for Business installation file” if you do not need to carry out
this function)

As I stated in my last article, existing versions of Chrome will
not receive the new settings contained in the preferences file, so you should plan
to remove these Chrome installations (or instruct users to do so) and conduct a
re-install using the Chrome for Business installer and the associated master preferences
file.

Piyush Nasa of MSIworld.blogspot.com.au put together a great VBS script to remove Chrome if you’d like to speed
up the process. Editor’s note: This
script is provided as is.

'===================================== 'Lines to get the computer Name Const HKEY_LOCAL_MACHINE = &H80000002 Set wshShell = WScript.CreateObject( "WScript.Shell" ) strComputerName = wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" ) dim folder, MyProperties, arrMyProperties, Exe, Param, oReg, strKeyPath, strValueName '============================================================== 'To check whether the OS is 32 bit or 64 bit of Windows 7 '============================================================== 'Lines to detect whether the OS is 32 bit or 64 bit of Windows 7 Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputerName & "\root\default:StdRegProv") strKeyPath = "HARDWARE\DESCRIPTION\System\CentralProcessor\0" strValueName = "Identifier" oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue '============================================================== 'Checking Condition whether the build is 64bit or 32 bit if (instr(strValue,"64")) then folder = "C:\Program Files (x86)\Google\Chrome" RegVal = ReadReg ("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Google Chrome\UninstallString") End If if (instr(strValue,"x86")) then folder = "C:\Program Files\Google\Chrome" RegVal = ReadReg ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Google Chrome\UninstallString") End If '============================================================== MyProperties = RegVal arrMyProperties = Split(MyProperties, "-") Exe = arrMyProperties(0) Param = "--uninstall --multi-install --chrome --system-level --force-uninstall" 'Uninstall Previous version Chrome '============================================================== wshShell.run Exe & Param, 1, True 'Delete leftover folder and files from Previous version Chrome '============================================================== dim filesys Set filesys = CreateObject("Scripting.FileSystemObject") If filesys.FolderExists(folder & "\") Then filesys.DeleteFolder folder End If Function ReadReg(RegPath) Dim objRegistry, Key Set objRegistry = CreateObject("Wscript.shell") Key = objRegistry.RegRead(RegPath) ReadReg = Key End Function

Copy and paste the above text into a file and save it as ChromeRemove.vbs.
You can copy this file to a network folder and instruct users to run it (they may
need to authorize it to run depending on existing anti- malware software). You can
also execute it remotely on their computers – as long as they are inside your network
– using a batch file (.bat) that utilizes Windows Sysinternals’
PsExec utility
. PsExec is a very handy program that lets you run commands
on remote computers. This process requires you to have administrative access on
the remote systems and their C: drive shared as C$ (standard in Windows environments).

  1. Download PsTools
    (which contains psexec.exe and other useful tools) and extract the contents to your
    C:\Windows folder.
  2. Copy the ChromeRemove.vbs file into a new directory
    called “chromerollout” on your PC.
  3. Create a text file called computers.txt in that chromerollout
    directory.
  4. Enter the names of the computers from which you want
    to remove Chrome into the computers.txt file (I highly encourage you to only enter
    one or two systems at first so you can test this; after you’ve confirmed success
    you can then put in all the designated computer names). Enter each system name on
    its own line.
  5. Create a new batch file in the chromerollout directory
    called ChromeUninstall.bat.
  6. Copy the text below into the ChromeUninstall.bat
    file.
  7. Save the ChromeRemover.bat file to your local
    chromerollout folder then run it when ready (if this is your first time using
    PsExec you’ll have to accept a license agreement to proceed).

--------------------------------------------------------------------
FOR /F "tokens=1" %%i in (computers.txt) do md \\%%i\c$\chromesetup
FOR /F "tokens=1" %%i in (computers.txt) do xcopy ChromeRemove.vbs \\%%i\c$\chromesetup /D
FOR /F "tokens=1" %%i in (computers.txt) do psexec \\%%i cscript c:\chromesetup\ChromeRemove.vbs -h
pause
--------------------------------------------------------------------

This .bat file will:

  • -Create a folder called “chromesetup”
    on the C: drive of the target system.
  • -Copy the ChromeRemove.vbs
    script to the new chromesetup folder (only if the local copy is newer).
  • -Run the ChromeRemove.vbs script
    on that remote system with elevated privileges.
  • -Pause at the end with a prompt
    for you to press any key to continue. This allows you to review the results.

You can confirm that Chrome has been removed by inspecting the
contents of C:\Program Files\Google on the remote system – there should be no “Chrome”
subfolder underneath this location. Check the contents of the C:\Users\(username)\AppData\Local\Google\Chrome
to confirm no Chrome.exe file exists. You’ll also need to remove the user’s existing
Chrome data to ensure they receive the desired settings when you install Chrome
for Business.

For Windows XP:

C:\Documents and Settings\(username)\Local
Settings\Application Data\Google\Chrome\User Data

For Windows 7:

C:\Users\(username)\AppData\Local\Google\Chrome\User
Data

If you have problems getting
this to work

If
the.bat file doesn’t work due to access errors, you may need to edit the third line
as follows:

FOR /F “tokens=1” %%i in (computers.txt)
do psexec – u user –p password\\%%i cscript c:\chromesetup\ChromeRemove.vbs -h

Replace
“user” with a user account on the target machine that has administrator
privileges, and “password” with the corresponding password. Obviously
for security purposes you should never save this .bat file anywhere public since
it contains the password in plain text format. Remove the password from the file
when done.

If
you still have no luck, temporarily disable User Account Control on Vista/Windows 7/Windows 8 (or have the remote user
do so). I realize this sounds controversial, but it should only be done for a small interim of time. However,
refer to your security guidelines before considering this step.

If
you receive an error starting “c:\chromesetup\ChromeRemove.vbs(46, 7) WshShell.RegRead:
Invalid root in registry key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Google
Chrome\UninstallString” there is a problem with the existing Chrome installation;
it will have to be manually removed.

Once Chrome has been removed, you are ready to proceed with the
deployment.

Download the Chrome for Business installation file

Access the Chrome
for Business page for administrators
.

Figure A

Click “Download Chrome MSI.” The following box will
appear:

Figure B

You can uncheck “Set Google Chrome as my default browser”
if you like then click “Accept and Install.” This box is a bit misleading
because it seems to indicate that Chrome will then automatically install on your
system, but instead you will be provided the option to save the GoogleChromeStandaloneEnterprise.msi
file to your hard drive or a network share.

Configure the Google Chrome master preferences file

The preferences file appears in the following JSON format (courtesy
of an article on www.chromium.org
titled “Configuring
Other Preferences
“):

---------------------------------------------------------------------
{
"homepage" : "http://www.google.com",
"homepage_is_newtabpage" : true,
"browser" : {
"show_home_button" : true, "check_default_browser" : false },
"session" : {
"restore_on_startup" : 4,
"urls_to_restore_on_startup" : [
"http://www.google.com/ig"
]},
"bookmark_bar" : {
"show_on_all_tabs" : true
},
"distribution" : {
"alternate_shortcut_text": "alternate text for the shortcut",
"auto_launch_chrome": true,
"chrome": true,
"app_host": true,
"chrome_frame": true,
"ready_mode": true,
"chrome_shortcut_icon_index": 1,
"disable_logging": true,
"import_bookmarks": true,
"import_bookmarks_from_file": "bookmarks.html",
"import_history": true,
"import_home_page": true,
"import_search_engine": true,
"ping_delay": 60,
"show_welcome_page": false,
"skip_first_run_ui": true,
"suppress_first_run_bubble": true,
"do_not_create_desktop_shortcut": true,
"do_not_create_quick_launch_shortcut": true,
"do_not_launch_chrome": true,
"do_not_register_for_update_launch": true,
"log_file": "log.txt",
"make_chrome_default": true,
"make_chrome_default_for_user": true,
"suppress_first_run_default_browser_prompt": true,
"msi": true,
"multi_install": true,
"require_eula": true,
"system_level": true,
"verbose_logging": true
},
"first_run_tabs" : [
"http://www.example.com",
"welcome_page",
"new_tab_page"
]
}
---------------------------------------------------------------------

Copy the above contents and paste them into a text editor. You
can use Notepad, but Notepad++ is a free alternative which is vastly superior and
I highly recommend
you get it
.

Much of the contents will be self-explanatory; “homepage”
for instance represents the home page URL. “urls_to_restore_on_startup”
refers to sites you’d like opened automatically when Chrome loads. You can enter
your company’s website or intranet here, for instance, to provide users with necessary
access to business information.

The page referenced above on chromium.org contains some helpful
information about how to customize your preferences:

Figure C

To add custom bookmarks for users

Use Chrome to set up the bookmarks you want users to have then
press Ctrl-Shift-O to access the Bookmarks Manager. Click “Organize” then
choose “Export Bookmarks to HTML file.” You can save the resulting .html
file to your chromerollout folder.

Include these elements in your preferences file.

Under the “distribution” section:

"import_bookmarks": false,
"import_bookmarks_from_file": "c:\\chromesetup\\bookmarks.html",
"skip_first_run_ui": true
Under the "bookmark bar" section:
"show_on_all_tabs": true" id="shortcode6

(The path c:\\chromesetup\\bookmarks.html will come into play
when you set up the Chrome installation batch file, as discussed below – you must
use those double back slashes).

Once you’re done configuring the master_preferences file, save
it. (It must be titled master_preferences).

Validating the master preferences file

Before distributing Chrome you should validate your preferences
file to ensure the code is legitimate and there are no errors. Access http://jsonlint.com/ to
do so:

Figure D

Paste the contents of your preferences file into the field where
it says “Enter JSON to validate, or a URL to JSON to validate.”

Figure E

Click “Validate.” The results field below should show
“Valid JSON”:

Figure F

If an error is displayed you’ll need to recheck the syntax and
structure of your preferences file, and possibly start over if you cannot validate
the contents.

Installing Chrome for Business on local computers

The syntax to install the Chrome MSI file is:

msiexec /q /I GoogleChromeStandaloneEnterprise.msi

 

 

If you want each user to be able to install Chrome on their own
using the master_preferences file, you can do so by creating a custom batch file
(which users will need administrator privileges to run). Create a new folder on
a public network share or some other centralized location they can access. Copy
the master_preferences, the GoogleChromeStandaloneEnterprise.msi installation file
and the bookmarks.html file (if this last item is applicable) to the new folder.

Now create a file called ChromeInstall.bat which contains the
following lines:

--------------------------------------------------------------------
if not exist c:\chromesetup md c:\chromesetup
xcopy GoogleChromeStandaloneEnterprise.msi c:\chromesetup
xcopy bookmarks.html c:\chromesetup
md "c:\program files\google\chrome\application"
msiexec /q /I c:\chromesetup\GoogleChromeStandaloneEnterprise.msi
xcopy master_preferences "c:\program files\google\chrome\application" /y
pause
--------------------------------------------------------------------

(you can leave out the third line if you are not deploying a
bookmarks file)

This .bat file will:

  1. Create a folder called “chromesetup” on
    the C: drive.
  2. Copy the relevant files to the new chromesetup folder.
  3. Create the c:\program files\google\chrome\application
    folder.
  4. Run the Google Chrome installer (which will import
    the desired bookmarks if you have set up this option).
  5. Copy the master_preferences file to c:\program files\google\chrome\application
    – this is critical for the settings to be deployed properly, since this file must
    be in the same folder as the chrome.exe file.
  6. Pause at the end with a prompt for you to press any
    key to continue. This allows you to review the results.

You can copy the entire folder to a flash drive or other portable
storage medium to distribute for home computers and the like.

If attempting to run the .msi file produces permissions or access
errors, the user might need to right-click the file, go to Properties and click
the “Unblock” button:

Figure G

If problems develop and you need to restart the process, delete
the local Chrome user data folder.

For Windows XP:

C:\Documents and Settings\(username)\Local Settings\Application
Data\Google\Chrome\User Data

 

 

For Windows 7:

C:\Users\(username)\AppData\Local\Google\Chrome\User Data

Installing Chrome for Business on remote computers

This process is similar to the one described above in the “Removing prior versions of Chrome” section. You can
carry out the installation process on remote
computers within your network using a .bat file that utilizes Windows Sysinternals’ PsExec utility. PsExec is a very handy
program that lets you run commands on remote computers. This process requires you
to have administrative access on the remote systems and their C: drive shared as
C$ (standard in Windows environments).

  1. Download PsTools (which contains
    psexec.exe and other useful tools) and extract the contents to your C:\Windows folder.
  2. Copy the Google Chrome
    Business installer you previously downloaded into a new directory (e.g. chromerollout).
  3. Create a text file
    called computers.txt in that same directory.
  4. Enter the names of
    the computers on which you want to install Chrome into the computers.txt file (I
    highly encourage you to only enter one or two systems at first so you can test this;
    after you’ve confirmed success you can then put in all the designated computer names).
    Enter each system name on its own line.
  5. Create a new batch
    file in the same directory called ChromeInstall.bat.
  6. Copy the text below
    into the ChromeInstall.bat file:

--------------------------------------------------------------------
FOR /F "tokens=1" %%i in (computers.txt) if not exist \\%%i\c$\chromesetup md \\%%i\c$\chromesetup
FOR /F "tokens=1" %%i in (computers.txt) xcopy GoogleChromeStandaloneEnterprise.msi \\%%i\c$\chromesetup /D
FOR /F "tokens=1" %%i in (computers.txt) xcopy bookmarks.html \\%%i\c$\chromesetup /D
FOR /F "tokens=1" %%i in (computers.txt) md "\\%%i\c$\program files\google\chrome\application"
FOR /F "tokens=1" %%i in (computers.txt) do psexec \\%%i msiexec /q /I c:\chromesetup\GoogleChromeStandaloneEnterprise.msi
FOR /F "tokens=1" %%i in (computers.txt) xcopy master_preferences "\\%%i\c$\program files\google\chrome\application" /y
pause
---------------------------------------------------------------------

(you can leave out the third line if you are not deploying a
bookmarks file)

This .bat file will:

  1. Create a folder called “chromesetup” on
    the C: drive of the target system.
  2. Copy the relevant files to the new chromesetup folder.
  3. Create the c:\program files\google\chrome\application
    folder.
  4. Run the Google Chrome installer (which will import
    the desired bookmarks if you have set up this option).
  5. Copy the master_preferences file to c:\program files\google\chrome\application
    – this is critical for the settings to be deployed properly!
  6. Pause at the end with a prompt for you to press any
    key to continue. This allows you to review the results.

Run your ChromeInstall.bat file when ready. Installation problems
(and success) will be logged in the Windows Application Log. You can also check
these files if you run into any issues:

%TEMP%\chrome_installer.log

 

 

%TEMP%\chrome_frame_installer.log

If you don’t see any Windows Application log entries related
to this effort and neither of the above files are present there may be a problem
with your installation script/routine and the installation was never attempted.

Once you’re comfortable with this procedure and you are seeing
the expected results you can plan the company-wide rollout.

Part three of this article series will cover configuring Chrome
policies and extensions for Google Apps users via the Admin Console.

Getting more information

I highly recommend bookmarking
Google’s Chrome for Business and Education page which contains lots of useful data (including
how to set up legacy browser support to automatically open certain websites in other
browsers). There is also a Chrome for Business FAQ here.

Also read: