Làm cách nào tôi có thể tùy chỉnh cài đặt mặc định khi triển khai Google Chrome dành cho doanh nghiệp?


14

Tôi muốn có thể triển khai Google Chrome for Business trong tổ chức của mình mà không cần thêm bất kỳ phím tắt nào và không có bất kỳ lời nhắc đầu tiên nào. Trình cài đặt Chrome for Business là tệp Windows Installer (MSI), nhưng nó chỉ là một trình bao bọc xung quanh trình cài đặt thực thi. Nó không có các thuộc tính như CreatDesktopShortcut có thể được đặt ở dòng lệnh msiexec giống như nhiều trình cài đặt MSI làm. Làm thế nào tôi có thể tùy chỉnh cài đặt của tôi? Tôi không muốn viết và duy trì một kịch bản cài đặt.

Câu trả lời:


24

Google Chrome lưu các tùy chọn người dùng mặc định trong tệp master_preferences . Đây là một tệp văn bản ở định dạng JSON và nó bao gồm một distributionđối tượng chứa các cài đặt sẽ được đọc trong khi cài đặt. Chỉnh sửa tệp này trong cài đặt Chrome hiện tại không giải quyết được vấn đề vì cài đặt rõ ràng đã xảy ra tại thời điểm đó. Giải pháp là tích hợp tệp master_preferences tùy chỉnh vào quy trình cài đặt Windows Installer bằng cách sử dụng tệp chuyển đổi. Thực hiện các bước sau để thực hiện điều này.

Tập hợp các Trình cài đặt và Công cụ cần thiết

  1. Trình cài đặt Google Chrome dành cho doanh nghiệp .
    Tôi sẽ tải xuống phiên bản 64 bit E:\Chrome for Business 38 (64-bit).
  2. Bộ phát triển phần mềm Microsoft Windows (SDK) cho Windows 8.1 .
    Tôi sẽ tải cái này về E:\WindowsSDK8.1.
  3. Cài đặt SDK Windows : E:\WindowsSDK8.1.\sdksetup.exe.
  4. Cài đặt Orca (trình chỉnh sửa cơ sở dữ liệu Windows Installer) :
    msiexec /package "C:\Program Files (x86)\Windows Kits\8.1\bin\x86\Orca-x86_en-us.msi".

Viết tệp master_preferences tùy chỉnh

  1. Xem lại các cài đặt phân phối có sẵn. Đây là các thuộc tính của một distributionđối tượng, được chứa trong đối tượng ẩn danh trong tệp master_preferences. Danh sách cài đặt sau đây được tổng hợp bằng cách kết hợp hai tệp nguồn Chromium: master_preferences_constants.hmaster_preferences_constants.cc trong / trunk / src / chrome / Installer / produc / . Lưu ý rằng dưới đây không phải là JSON hợp lệ vì không có giá trị nào được bao gồm cho các thuộc tính. Một ví dụ được hiển thị thêm dưới đây.
{
  "distribution" : {
    // All the preferences below are expected to be inside the JSON "distribution"
    // block (as shown here). Some of them also have equivalent command line option. 
    // If same option is specified in master preference as well as command line, 
    // the command line value takes precedence.

    // Boolean. Use alternate text for the shortcut. Cmd line override present.
    "alternate_shortcut_text"

    // Boolean. Whether to instruct the installer to auto-launch chrome on computer
    // startup. The default (if not provided) is |false|.
    "auto_launch_chrome"

    // Boolean. This is to be a Chrome install. (When using MultiInstall)
    "chrome"

    // Boolean. This is to be a Chrome App Host install.
    "app_host"  // TODO(huangs): Remove by M27.

    // Boolean. This is to be a Chrome App Launcher install.
    "app_launcher"

    // Integer. Icon index from chrome.exe to use for shortcuts.
    "chrome_shortcut_icon_index"

    // Boolean. This is a legacy preference and should no longer be used; it is
    // kept around so that old master_preferences which specify
    // "create_all_shortcuts":false still enforce the new
    // "do_not_create_(desktop|quick_launch)_shortcut" preferences. Setting this to
    // true no longer has any impact.
    "create_all_shortcuts"

    // Boolean pref that disables all logging.
    "disable_logging"

    // Name of the dictionary that holds the distribution values.
    "distribution"

    // Boolean pref that triggers silent import of the default browser bookmarks.
    "import_bookmarks"

    // String pref that triggers silent import of bookmarks from the html file at
    // given path.
    "import_bookmarks_from_file"

    // Boolean pref that triggers silent import of the default browser history.
    "import_history"

    // Boolean pref that triggers silent import of the default browser homepage.
    "import_home_page"

    // Boolean pref that triggers silent import of the default search engine.
    "import_search_engine"

    // Integer. RLZ ping delay in seconds.
    "ping_delay"

    // String of Chrome version for which the "set as default browser" infobar will
    // never be shown.
    "suppress_default_browser_prompt_for_version"

    // Boolean. Do not show first run bubble, even if it would otherwise be shown.
    "suppress_first_run_bubble"

    // Boolean. Prevent creation of all shortcuts to chrome, including the
    // desktop, quick launch, taskbar and the start menu shortcuts.
    "do_not_create_any_shortcuts"

    // Boolean. Prevent creation of the Desktop shortcut on install (and later on
    // Active Setup for each user on a system-level install).
    "do_not_create_desktop_shortcut"

    // Boolean. Prevent creation of the Quick Launch shortcut on install (and later
    // on Active Setup for each user on a system-level install).
    "do_not_create_quick_launch_shortcut"

    // Boolean. Prevent creation of the Taskbar (since Windows 7) shortcut on
    // install (and later on Active Setup for each user on a system-level install).
    "do_not_create_taskbar_shortcut"

    // Boolean. Do not launch Chrome after first install. Cmd line override present.
    "do_not_launch_chrome"

    // Boolean. Do not register with Google Update to have Chrome launched after
    // install. Cmd line override present.
    "do_not_register_for_update_launch"

    // String.  Specifies the file path to write logging info to.
    "log_file"

    // Boolean. Register Chrome as default browser. Cmd line override present.
    "make_chrome_default"

    // Boolean. Register Chrome as default browser for the current user.
    "make_chrome_default_for_user"

    // Boolean. Expect to be run by an MSI installer. Cmd line override present.
    "msi"

    // Boolean. Support installing multiple products at once.
    "multi_install"

    // Boolean. Show EULA dialog before install.
    "require_eula"

    // Boolean. Indicates that the first-run 'set-as-default' dialog should not be
    // shown. Relevant in Windows 8+ context only. If this is true, the standard
    // 'set default browser' prompt on the butter-bar will appear during the first
    // run.
   "suppress_first_run_default_browser_prompt"

    // Boolean. Install Chrome to system wise location. Cmd line override present.
    "system_level"

    // Boolean. Run installer in verbose mode. Cmd line override present.
    "verbose_logging"

    // Name of the block that contains the extensions on the master preferences.
    "extensions.settings"
  }
}
  1. Xem lại các cài đặt không phân phối có sẵn. Các thiết lập này đi bên ngoài của distributionđối tượng trong JSON. Chúng được áp dụng cho hồ sơ người dùng khi người dùng chạy Chrome lần đầu tiên. Danh sách đầy đủ các cài đặt có sẵn trong các tệp nguồn Chromium pref_names.hpref_names.cc trong / trunk / src / chrome / common / . Danh sách này khá dài, vì vậy chỉ có một tập hợp con được hiển thị ở đây.
{
// *************** PROFILE PREFS ***************
// These are attached to the user profile

// A string property indicating whether default apps should be installed
// in this profile.  Use the value "install" to enable defaults apps, or
// "noinstall" to disable them.  This property is usually set in the
// master_preferences and copied into the profile preferences on first run.
// Defaults apps are installed only when creating a new profile.
"default_apps"

// If set to true profiles are created in ephemeral mode and do not store their
// data in the profile folder on disk but only in memory.
"profile.ephemeral_mode"

// A boolean specifying whether the New Tab page is the home page or not.
"homepage_is_newtabpage"

// This is the URL of the page to load when opening new tabs.
"homepage"

// An integer pref. Holds one of several values:
// 0: (deprecated) open the homepage on startup.
// 1: restore the last session.
// 2: this was used to indicate a specific session should be restored. It is
//    no longer used, but saved to avoid conflict with old preferences.
// 3: unused, previously indicated the user wants to restore a saved session.
// 4: restore the URLs defined in kURLsToRestoreOnStartup.
// 5: open the New Tab Page on startup.
"session.restore_on_startup"

// The URLs to restore on startup or when the home button is pressed. The URLs
// are only restored on startup if kRestoreOnStartup is 4.
"session.startup_urls"

// Boolean that is true when SafeBrowsing is enabled.
"safebrowsing.enabled"

// Boolean that tell us whether malicious download feedback is enabled.
"safebrowsing.extended_reporting_enabled"

/* Might be useful for highly-secure workstations. */
// Enum that specifies whether Incognito mode is:
// 0 - Enabled. Default behaviour. Default mode is available on demand.
// 1 - Disabled. Used cannot browse pages in Incognito mode.
// 2 - Forced. All pages/sessions are forced into Incognito.
"incognito.mode_availability"

// Boolean that is true when Suggest support is enabled.
"search.suggest_enabled"

// A boolean pref set to true if a Home button to open the Home pages should be
// visible on the toolbar.
"browser.show_home_button"

// Boolean that indicates whether we should check if we are the default browser
// on start-up.
"browser.check_default_browser"

// Policy setting whether default browser check should be disabled and default
// browser registration should take place.
"browser.default_browser_setting_enabled"

// Boolean that specifies whether to import bookmarks from the default browser
// on first run.
"import_bookmarks"

// Boolean that specifies whether to import the browsing history from the
// default browser on first run.
"import_history"

// Boolean that specifies whether to import the homepage from the default
// browser on first run.
"import_home_page"

// Boolean that specifies whether to import the search engine from the default
// browser on first run.
"import_search_engine"

// Boolean that specifies whether to import the saved passwords from the default
// browser on first run.
"import_saved_passwords"

// Boolean that specifies if the sign in promo is allowed to show on first run.
// This preference is specified in the master preference file to suppress the
// sign in promo for some installations.
"sync_promo.show_on_first_run_allowed"

// *************** LOCAL STATE ***************
// These are attached to the machine/installation

// Note: Both settings included below are for Windows only.

// Whether downloaded PDFs should be opened in Adobe Acrobat Reader.
"download.open_pdf_in_adobe_reader"

// Preference to be used while relaunching Chrome. This preference dictates if
// Chrome should be launched in Metro or Desktop mode.
// For more info take a look at ChromeRelaunchMode enum.
"relaunch.mode"

// Boolean that specifies if the sign in promo is allowed to show on first run.
// This preference is specified in the master preference file to suppress the
// sign in promo for some installations.
"sync_promo.show_on_first_run_allowed";

// Boolean that specifies if we should show a bubble in the new tab page.
// The bubble is used to confirm that the user is signed into sync.
"sync_promo.show_ntp_bubble";

// As part of the master preferences an optional section indicates the tabs
// to open during first run. An example is the following:
"first_run_tabs": [
  "http://google.com/f1",
  "https://google.com/f2"
]
// Note that the entries are usually urls but they don't have to be.
  1. Chọn cài đặt bạn muốn và viết tệp văn bản master_preferences tùy chỉnh của riêng bạn. Đây là cái được tích hợp trong tệp Windows Installer (được mở rộng thành nhiều dòng để dễ đọc):
{
  "distribution" : 
  {
    "msi" : true,
    "system_level" : true,
    "verbose_logging" : true
  }
}

Bạn phải bao gồm tất cả các thuộc tính này như được hiển thị trong tệp master_preferences của bạn để trình cài đặt hoạt động chính xác. Do đó, bạn nên bắt đầu với điều này và thêm vào nó. Tập tin của tôi được hiển thị dưới đây. Cách duy nhất tôi tìm thấy để ngăn Chrome yêu cầu người dùng định cấu hình tài khoản Google là đặt thuộc first_run_tabstính.

{
  "browser" : {
    "check_default_browser" : false
  },
  "distribution" : {
    "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,
    "msi" : true,
    "require_eula" : false,
    "suppress_first_run_default_browser_prompt" : true,
    "system_level" : true,
    "verbose_logging" : true
  },
  "first_run_tabs" : [
    "chrome://newtab"
  ],
  "homepage" : "chrome://newtab",
  "homepage_is_newtabpage" : true,
  "sync_promo" : {
    "show_on_first_run_allowed" : false
  }
}
  1. Duyệt đến http://jslint.com/ , sao chép JSON của bạn vào hộp Nguồn và nhấp vào nút JSLint. Điều này sẽ xác minh rằng bạn có JSON tốt. Điều này rất quan trọng, vì việc cung cấp JSON không đúng định dạng cho trình cài đặt sẽ mang lại kết quả không mong muốn và / hoặc không mong muốn. Lưu tệp được xác minh để tham khảo trong tương lai.

  2. Tạo một bản sao JSON đã được xác minh của bạn và xóa tất cả các khoảng trắng và các dòng mới. Trình cài đặt Chrome không thể xử lý các dòng mới; bao gồm các dòng mới sẽ dẫn đến một cài đặt bị hỏng phải được gỡ bỏ thông qua phẫu thuật đăng ký và xóa các tập tin thủ công. Xóa các khoảng trắng có thể không cần thiết, nhưng nó phù hợp với những gì các tác giả thiết lập đã làm với JSON mặc định. Của tôi được hiển thị dưới đây.

{"browser":{"check_default_browser":false},"distribution":{"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,"msi":true,"require_eula":false,"suppress_first_run_default_browser_prompt":true,"system_level":true,"verbose_logging":true},"first_run_tabs":["chrome://newtab"],"homepage":"chrome://newtab","homepage_is_newtabpage":true,"sync_promo":{"show_on_first_run_allowed":false}}
  1. Chạy JSON mới mà không có khoảng trắng thông qua JSLint để đảm bảo rằng bạn không đưa ra bất kỳ lỗi nào.

  2. Sao chép JSON đã được xác minh mà không có dấu cách hoặc dòng mới vào bộ mã hóa URL. Tôi đã sử dụng Mã hóa URL / Giải mã trực tuyến . Lưu JSON được mã hóa để sử dụng trong trình cài đặt và để tham khảo trong tương lai. JSON được mã hóa của tôi được hiển thị dưới đây.

%7B%22browser%22%3A%7B%22check_default_browser%22%3Afalse%7D%2C%22distribution%22%3A%7B%22import_bookmarks%22%3Afalse%2C%22import_history%22%3Afalse%2C%22import_home_page%22%3Afalse%2C%22import_search_engine%22%3Afalse%2C%22suppress_first_run_bubble%22%3Atrue%2C%22do_not_create_desktop_shortcut%22%3Atrue%2C%22do_not_create_quick_launch_shortcut%22%3Atrue%2C%22do_not_create_taskbar_shortcut%22%3Atrue%2C%22do_not_launch_chrome%22%3Atrue%2C%22do_not_register_for_update_launch%22%3Atrue%2C%22make_chrome_default%22%3Afalse%2C%22make_chrome_default_for_user%22%3Afalse%2C%22msi%22%3Atrue%2C%22require_eula%22%3Afalse%2C%22suppress_first_run_default_browser_prompt%22%3Atrue%2C%22system_level%22%3Atrue%2C%22verbose_logging%22%3Atrue%7D%2C%22first_run_tabs%22%3A%5B%22chrome%3A%2F%2Fnewtab%22%5D%2C%22homepage%22%3A%22chrome%3A%2F%2Fnewtab%22%2C%22homepage_is_newtabpage%22%3Atrue%2C%22sync_promo%22%3A%7B%22show_on_first_run_allowed%22%3Afalse%7D%7D

Viết chuyển đổi Windows Installer

  1. Bắt đầu Orca.
  2. Mở tệp Chrome dành cho doanh nghiệp đã tải xuống dưới dạng chỉ đọc. (Tôi cho rằng bạn có thể chỉnh sửa tệp thực tế, nhưng tôi thích sử dụng các biến đổi để tôi luôn có tệp do nhà cung cấp làm cơ sở nếu mọi thứ trở nên tồi tệ.) Tôi đã tải xuống Chrome for Business 38 64 bit và tên tệp là googlechromestandaloneenterprise64.msi.
  3. Trên menu Transform , chọn New Transform . Bây giờ tất cả các bảng cơ sở dữ liệu Windows Installer đều có thể chỉnh sửa được vì bạn đang chỉnh sửa tệp biến đổi mới.
  4. Chọn bảng Thuộc tính.
  5. Nhấp chuột phải vào cột Thuộc tính và nhấp vào "Thêm hàng". Đặt Thuộc tính thành MASTER_PREFERENCESvà đặt Giá trị thành JSON được mã hóa URL của bạn. Mã này sẽ được áp dụng trong quá trình triển khai và được lưu master_preferencesbởi tập tin cài đặt.
  6. Chọn bảng CustomAction và định vị hành động BuildInstallCommand.
  7. Bấm đúp vào ô Target cho hành động BuildInstallCommand để làm cho nó có thể chỉnh sửa.
  8. Gần cuối văn bản, xóa JSON được mã hóa hiện có sau đây installerdata=và thay thế nó bằng tên thuộc tính mới trong ngoặc. Hãy chắc chắn để giữ lại dấu ngoặc kép đóng. Nó sẽ giống như thế này: installerdata=[MASTER_PREFERENCES]"
  9. Nhấn Enter để hoàn thành chỉnh sửa ô.
  10. Trên menu Chuyển đổi , nhấp vào Tạo Biến đổi và lưu tệp MST mới. Tôi đã cứu tôi như E:\Chrome for Business 38 (64-bit)\MasterPreferences.mst.
  11. Thoát khỏi Orca.

Lưu ý: Cần sử dụng một thuộc tính thay vì chèn JSON trực tiếp vào hành động tùy chỉnh vì trường Mục tiêu hành động tùy chỉnh chỉ dài 255 ký tự . Lược đồ của bảng đó không thể thay đổi và hầu hết JSON tùy chỉnh sẽ đưa tổng chiều dài của trường đó vượt quá giới hạn. Sử dụng một tài sản tránh được giới hạn độ dài, vì không có giới hạn thực tế cho chiều dài của giá trị tài sản.

Cài đặt Chrome với Chuyển đổi của bạn

  1. Mở cửa sổ Dấu nhắc Lệnh với các đặc quyền Quản trị.
  2. Cài đặt Google Chrome với chuyển đổi của bạn bằng cách đặt thuộc TRANSFORMStính thành tên tệp của nó. Bật đăng nhập để giúp bạn tìm thấy bất cứ điều gì sai. Sử dụng các thư mục mẫu của tôi và giả sử rằng bạn đã đăng nhập với tư cách Quản trị viên: msiexec /package "E:\Chrome for Business 38 (64-bit)\googlechromestandaloneenterprise64.msi" TRANSFORMS="E:\Chrome for Business 38 (64-bit)\MasterPreferences.mst" /l*v "C:\Users\Administrator\Desktop\ChromeInstallationLog.txt"
  3. Nếu Chrome cài đặt không có lỗi, hãy thử chạy nó với tư cách là người dùng không phải quản trị viên khác để đảm bảo rằng các cài đặt được truyền đúng.
  4. Cuối cùng, cấu hình hệ thống triển khai của bạn với tệp trình cài đặt và chuyển đổi. Tôi sử dụng Trình quản lý cấu hình hệ thống trung tâm 2012 R2 . Dòng lệnh của tôi cho Ứng dụng này tương tự như sau: msiexec /package "googlechromestandaloneenterprise64.msi" /quiet TRANSFORMS="MasterPreferences.mst" /l*v "%TEMP%\ChromeInstallationLog.txt" Điều này mang đến cho người dùng của tôi trải nghiệm giống như cửa hàng ứng dụng với ứng dụng Trung tâm phần mềm của Trình quản lý cấu hình, chỉ kiểm soát các biểu tượng trên màn hình và thanh tác vụ với người dùng và tránh những trải nghiệm khó chịu khi chạy lần đầu . Đây là trải nghiệm người dùng ưa thích của tôi nói chung, nhưng nó đặc biệt hữu ích cho các máy tính công khai, chẳng hạn như trong phòng thí nghiệm máy tính, nơi thay đổi ổ cứng bị mất trong mỗi lần khởi động lại, và vì vậy mỗi lần đăng nhập là lần đăng nhập "đầu tiên".

Ghi chú

Xem thêm tài liệu của Google về tệp master_preferences , bao gồm một tập hợp con của các cài đặt khả dụng, nhưng không cho bạn biết cách nhận cài đặt trên máy trong khi cài đặt.

Cảm ơn grt@chromium.org đã chỉ ra khả năng tùy biến MSI . Mục tiêu của tôi ở đây là mở rộng thông tin đó để cung cấp giải thích toàn diện và giải pháp ví dụ. Tôi hi vọng nó hữu ích.


Đây là một hướng dẫn tuyệt vời. Bạn là một anh hùng. :-)
tên người dùng

Vẫn là trường hợp? Soemone tại google cần phải bị sa thải vì điều này. Sổ đăng ký phải là "nó" - có thể đơn giản như một mục đăng ký chỉ đến tên tệp và vị trí có thể được triển khai như một công việc tầm thường trong 5 phút trong Wix.
TomTom

0

Tôi không có đủ đại diện để đăng bình luận. Tôi đã sử dụng hướng dẫn của Jay để giúp giải quyết vấn đề về việc tải xuống một loại tệp để tự động chạy. Và điều này dường như là cách duy nhất để làm điều đó vào lúc này:

https://bugs.chromium.org/p/chromium/issues/detail?id=476668

- Liên kết này đề cập đến một lỗi mà AFAIK không được sửa. Phóng viên muốn có thể đặt các loại tệp cụ thể để tự động chạy trên d / l thông qua GPO. Trường hợp sử dụng cho điều này bị hạn chế do các tác động bảo mật, nhưng đôi khi cần thiết trong việc triển khai doanh nghiệp. Nó có thể đạt được bằng cách sử dụng kỹ thuật của Jay trong .mst với master_preferences. (chỉnh sửa để phản hồi bình luận của Chick)

Tôi đồng ý với bạn Tomtom, nên có một cách dễ dàng hơn. Trong phần lớn .admx của Google là đủ.


Bất kể bạn có bao nhiêu đại diện: một câu trả lời chỉ liên kết có khả năng bị xóa. Bạn có thể tự mình hiểu điều này như một câu trả lời không và chỉ tham khảo liên kết cho những người muốn xác minh những gì bạn đang nói hoặc đào sâu hơn. serverfault.com/help/how-to-answer
gà con
Khi sử dụng trang web của chúng tôi, bạn xác nhận rằng bạn đã đọc và hiểu Chính sách cookieChính sách bảo mật của chúng tôi.
Licensed under cc by-sa 3.0 with attribution required.