Jak mogę dostosować ustawienia domyślne podczas wdrażania Google Chrome dla Firm?


14

Chcę móc wdrożyć Google Chrome dla Firm w mojej organizacji bez tworzenia dodatkowych skrótów i bez monitów przy pierwszym uruchomieniu. Instalator Chrome dla Firm to plik Instalatora Windows (MSI), ale jest to tylko opakowanie wokół wykonywalnego instalatora. Nie ma takich właściwości, jak CreateDesktopShortcut, które można ustawić w wierszu poleceń msiexec, jak wiele instalatorów MSI. Jak mogę dostosować moją instalację? Wolałbym nie pisać i utrzymywać skryptu instalacyjnego.

Odpowiedzi:


24

Google Chrome przechowuje domyślne preferencje użytkownika w pliku master_preferences . Jest to plik tekstowy w formacie JSON i zawiera distributionobiekt zawierający ustawienia, które zostaną odczytane podczas instalacji. Edycja tego pliku w istniejącej instalacji Chrome nie rozwiązuje problemu, ponieważ instalacja już oczywiście miała miejsce w tym momencie. Rozwiązaniem jest zintegrowanie dostosowanego pliku master_preferences z procesem instalacji Instalatora Windows za pomocą pliku transformacji. Wykonaj następujące kroki, aby to osiągnąć.

Zbierz wymagane instalatory i narzędzia

  1. Instalator Google Chrome dla Firm .
    Pobiorę wersję 64-bitową na E:\Chrome for Business 38 (64-bit).
  2. Zestaw Microsoft Windows Software Development Kit (SDK) dla systemu Windows 8.1 .
    Ściągnę to do E:\WindowsSDK8.1.
  3. Zainstalować Windows SDK: E:\WindowsSDK8.1.\sdksetup.exe.
  4. Zainstalować Orca (Edytor bazy danych Instalator Windows)
    msiexec /package "C:\Program Files (x86)\Windows Kits\8.1\bin\x86\Orca-x86_en-us.msi".

Napisz dostosowany plik master_preferences

  1. Przejrzyj dostępne ustawienia dystrybucji. Są to właściwości distributionobiektu, który jest zawarty w obiekcie anonimowym w pliku master_preferences. Poniższa lista ustawień została skompilowana przez połączenie dwóch plików źródłowych Chromium: master_preferences_constants.h i master_preferences_constants.cc w / trunk / src / chrome / installer / util / . Zwróć uwagę, że poniższe informacje nie są poprawne JSON, ponieważ nie podano wartości dla właściwości. Przykład pokazano poniżej.
{
  "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. Przejrzyj dostępne ustawienia braku dystrybucji. Ustawienia te iść na zewnątrz z distributionobiektu w JSON. Są one stosowane do profilu użytkownika, gdy użytkownik uruchamia Chrome po raz pierwszy. Pełna lista ustawień jest dostępna w plikach źródłowych Chromium pref_names.h i pref_names.cc w / trunk / src / chrome / common / . Lista jest dość długa, więc pokazany jest tutaj tylko podzbiór.
{
// *************** 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. Wybierz odpowiednie ustawienia i napisz własny niestandardowy plik tekstowy master_preferences. Oto ten, który jest wbudowany w plik Instalatora Windows (rozszerzony do wielu wierszy dla czytelności):
{
  "distribution" : 
  {
    "msi" : true,
    "system_level" : true,
    "verbose_logging" : true
  }
}

Musisz dołączyć wszystkie te właściwości, jak pokazano w pliku master_preferences, aby instalator działał poprawnie. Dlatego powinieneś zacząć od tego i dodać do tego. Mój plik pokazano poniżej. Jedynym sposobem, aby powstrzymać Chrome przed pytaniem użytkownika o skonfigurowanie konta Google, było ustawienie first_run_tabswłaściwości.

{
  "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. Przejdź do strony http://jslint.com/ , skopiuj swój JSON do pola Źródło i kliknij przycisk JSLint. To sprawdzi, czy masz dobry JSON. Jest to ważne, ponieważ podanie zniekształconego JSON-a instalatorowi przyniesie nieoczekiwane i / lub niepożądane rezultaty. Zapisz zweryfikowany plik do wykorzystania w przyszłości.

  2. Utwórz kopię zweryfikowanego JSON i usuń wszystkie spacje i nowe wiersze. Instalator Chrome nie obsługuje nowych linii; w tym nowe wiersze spowodują uszkodzenie instalacji, którą należy usunąć za pomocą operacji rejestru i ręcznego usunięcia plików. Usuwanie spacji może nie być konieczne, ale odpowiada to, co zrobili autorzy instalacji z domyślnym JSON. Mój pokazano poniżej.

{"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. Uruchom nowy JSON bez spacji przez JSLint, aby upewnić się, że nie wprowadzono żadnych błędów.

  2. Skopiuj zweryfikowany JSON bez spacji i znaków nowej linii do kodera URL. Użyłem URL Encode / Decode Online . Zapisz zakodowany JSON do wykorzystania w instalatorze i do wykorzystania w przyszłości. Mój zakodowany JSON pokazano poniżej.

%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

Napisz transformację Instalatora Windows

  1. Uruchom Orca.
  2. Otwórz pobrany plik MSI Chrome for Business jako tylko do odczytu. (Przypuszczam, że możesz edytować rzeczywisty plik, ale lubię używać transformacji, więc zawsze mam plik dostarczony przez dostawcę jako podstawę, jeśli coś pójdzie nie tak.) Pobrałem Chrome na Business 38 64-bit, a nazwa pliku brzmiała googlechromestandaloneenterprise64.msi.
  3. W menu Przekształć wybierz polecenie Nowa transformacja . Teraz wszystkie tabele bazy danych Instalatora Windows są edytowalne, ponieważ edytujesz nowy plik transformacji.
  4. Wybierz tabelę właściwości.
  5. Kliknij prawym przyciskiem myszy kolumnę Właściwość i kliknij „Dodaj wiersz”. Ustaw właściwość na MASTER_PREFERENCESi ustaw wartość na kod JSON zakodowany w adresie URL. Ten kod zostanie zastosowany podczas wdrażania i zapisany przez instalatora jako master_preferencesplik instalacji.
  6. Wybierz tabelę CustomAction i zlokalizuj akcję BuildInstallCommand.
  7. Kliknij dwukrotnie komórkę docelową dla akcji BuildInstallCommand, aby można ją było edytować.
  8. Na końcu tekstu usuń istniejący kodowany kod JSON installerdata=i zastąp go nową nazwą właściwości w nawiasach. Pamiętaj, aby zachować końcowy znak cudzysłowu. To powinno wyglądać tak: installerdata=[MASTER_PREFERENCES]"
  9. Naciśnij Enter, aby zakończyć edycję komórki.
  10. W menu Przekształć kliknij polecenie Wygeneruj przekształcenie… i zapisz nowy plik MST. Uratowałem mój jako E:\Chrome for Business 38 (64-bit)\MasterPreferences.mst.
  11. Wyjdź z Orca.

Uwaga: Konieczne jest użycie właściwości zamiast wstawiania JSON bezpośrednio do akcji niestandardowej, ponieważ pole docelowe akcji niestandardowej ma tylko 255 znaków . Schematu tej tabeli nie można zmienić, a większość niestandardowych plików JSON przekroczyłaby całkowitą długość tego pola. Korzystanie z właściwości pozwala uniknąć ograniczenia długości, ponieważ nie ma praktycznego ograniczenia długości wartości właściwości.

Zainstaluj Chrome z transformacją

  1. Otwórz okno wiersza polecenia z uprawnieniami administracyjnymi.
  2. Zainstaluj Google Chrome ze swoją transformacją, ustawiając TRANSFORMSwłaściwość na nazwę pliku. Włącz rejestrowanie, aby znaleźć coś złego. Korzystając z moich przykładowych folderów i zakładając, że jesteś zalogowany jako Administrator: 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. Jeśli Chrome instaluje się bez błędów, spróbuj uruchomić go jako inny użytkownik nie będący administratorem, aby upewnić się, że ustawienia są poprawnie propagowane.
  4. Na koniec skonfiguruj system wdrażania przy użyciu instalatora i pliku transformacji. Używam System Center Configuration Manager 2012 R2 . Mój wiersz poleceń dla tej aplikacji jest podobny do następującego: msiexec /package "googlechromestandaloneenterprise64.msi" /quiet TRANSFORMS="MasterPreferences.mst" /l*v "%TEMP%\ChromeInstallationLog.txt" Daje to moim użytkownikom wrażenia podobne do sklepu z aplikacjami w Centrum oprogramowania Configuration Manager, pozostawia kontrolę nad ikonami pulpitu i paska zadań wyłącznie dla użytkownika i pozwala uniknąć irytujących wrażeń z pierwszego uruchomienia . Jest to ogólnie moje preferowane doświadczenie użytkownika, ale jest szczególnie przydatne na komputerach publicznych, takich jak laboratorium komputerowe, w którym zmiany dysku twardego są tracone przy każdym ponownym uruchomieniu, a więc każde logowanie jest „pierwszym” logowaniem.

Notatki

Zobacz także dokumentację Google na temat pliku master_preferences , który obejmuje podzbiór dostępnych ustawień, ale nie mówi ci, jak pobrać ustawienia na maszynę podczas instalacji.

Dziękujemy grt@chromium.org za wskazanie możliwości dostosowania MSI . Moim celem tutaj było rozwinięcie tych informacji, aby zapewnić kompleksowe wyjaśnienie i przykładowe rozwiązanie. Mam nadzieję, że to jest pomocne.


To jest doskonały przewodnik. Jesteś bohaterem. :-)
usershmusername

Nadal sprawa? W tym celu należy zwolnić Soemone w Google. Rejestr powinien być „to” - być może tak prosty jak wpis rejestru wskazujący nazwę pliku i lokalizację, którą można wdrożyć jako trywialne 5-minutowe zadanie w Wix.
TomTom

0

Nie mam wystarczającej liczby przedstawicieli, aby opublikować komentarz. Korzystałem z przewodnika Jaya, aby rozwiązać problem z automatycznym uruchomieniem pobranego typu pliku. W tej chwili wydaje się to jedynym sposobem:

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

- Ten link odnosi się do błędu, którego AFAIK nie naprawił. Reporter chciałby mieć możliwość ustawienia określonych typów plików, aby były uruchamiane automatycznie na d / l przez GPO. Przypadek użycia tego jest ograniczony ze względu na wpływ na bezpieczeństwo, ale czasami jest konieczny w przypadku wdrożeń korporacyjnych. Można to osiągnąć za pomocą techniki Jaya w .mst z master_preferences. (edytuj w odpowiedzi na komentarz Laska)

Zgadzam się z tobą, Tomtom, powinien być łatwiejszy sposób. W większości przypadków .admx Google jest wystarczający.


Niezależnie od tego, ile masz przedstawicieli: odpowiedź z linkiem może zostać usunięta. Czy może to mieć sens jako odpowiedź sama w sobie i po prostu odwołać się do linku dla tych, którzy chcą zweryfikować to, co mówisz lub zagłębić się głębiej. serverfault.com/help/how-to-answer
pisklęta
Korzystając z naszej strony potwierdzasz, że przeczytałeś(-aś) i rozumiesz nasze zasady używania plików cookie i zasady ochrony prywatności.
Licensed under cc by-sa 3.0 with attribution required.