Script to enable flash in google chrome

EliasG
Contributor

Does anyone have a script to enable flash in chrome. Newest version of Chrome you need to go into settings to enable it.

9 REPLIES 9

boberito
Valued Contributor

Last I looked at https://www.chromium.org/administrators/policy-list-3 it wasn't an option. So it may not be easy to do currently with a script or configuration profile.

bpavlov
Honored Contributor

Look at the following and see if it works via a configuration profile:
https://www.chromium.org/administrators/policy-list-3#DefaultPluginsSetting
https://www.chromium.org/administrators/policy-list-3#PluginsAllowedForUrls
https://www.chromium.org/administrators/policy-list-3#EnabledPlugins

The last link is a deprecated policy, but that doesn't mean it doesn't work.

Please report back on your success or lack thereof. Good luck.

rcram
New Contributor

In my provisioning script I write out a Google Preferences JSON for all clients and the User Template. The relevant keys are "default_content_setting_values" and "plugins". Using the example from HERE and adding options for password manager, incognito mode, plugins and popups we get the following:

{
    "homepage": "http://www.google.com",
    "homepage_is_newtabpage": false,
    "browser": {
        "show_home_button": true
    },
    "session": {
        "restore_on_startup": 4,
        "startup_urls": [
            "http://www.google.com/ig"
        ]
    },
    "bookmark_bar": {
        "show_on_all_tabs": true
    },
    "sync_promo": {
        "show_on_first_run_allowed": false
    },
    "profile": {
        "password_manager_enabled": false,
        "incognito.mode_availability": 1,
        "default_content_setting_values": {
            "plugins": 1,
            "popups": 1
        }
    },
    "distribution": {
        "import_bookmarks_from_file": "bookmarks.html",
        "import_bookmarks": true,
        "import_history": true,
        "import_home_page": true,
        "import_search_engine": true,
        "ping_delay": 60,
        "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,
        "make_chrome_default": true,
        "make_chrome_default_for_user": true,
        "suppress_first_run_default_browser_prompt": true,
        "system_level": true,
        "verbose_logging": true
    },
    "first_run_tabs": [
        "http://www.example.com",
        "http://welcome_page",
        "http://new_tab_page"
    ]
}

I cat it to a file, make sure permissions are good and move it into the /Library/Google/ directory as Google Chrome Master Preferences. This should condition everyone's default preferences. You can take it one step further by copying the JSON to the User Template in the /Library/Application Support/Google/Chrome/Default directory as Preferences.

rcram
New Contributor

As a follow up, I scrubbed my script a little to show what I do.

#!/bin/bash

UserTempEng="/System/Library/User Template/English.lproj"
# Set Google Chrome preferences
    echo "`date +"%a %b %d %X"` `hostname`: Configuring Google Chrome"
# Test if we have the Google directory in /Library already, if not create it.
    if [ ! -d "/Library/Google" ]; then
        mkdir -p "/Library/Google"
    fi
# Write JSON file with initial Google preferences using cat input redirection
(
cat << EOD
{
    "homepage": "http://www.google.com",
    "homepage_is_newtabpage": false,
    "browser": {
        "show_home_button": true
    },
    "session": {
        "restore_on_startup": 4,
        "startup_urls": [
            "http://www.google.com/ig"
        ]
    },
    "bookmark_bar": {
        "show_on_all_tabs": true
    },
    "sync_promo": {
        "show_on_first_run_allowed": false
    },
    "profile": {
        "password_manager_enabled": false,
        "incognito.mode_availability": 1,
        "default_content_setting_values": {
            "plugins": 1,
            "popups": 1
        }
    },
    "distribution": {
        "import_bookmarks_from_file": "bookmarks.html",
        "import_bookmarks": true,
        "import_history": true,
        "import_home_page": true,
        "import_search_engine": true,
        "ping_delay": 60,
        "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,
        "make_chrome_default": true,
        "make_chrome_default_for_user": true,
        "suppress_first_run_default_browser_prompt": true,
        "system_level": true,
        "verbose_logging": true
    },
    "first_run_tabs": [
        "http://www.example.com",
        "http://welcome_page",
        "http://new_tab_page"
    ]
}
EOD
) > "/tmp/Google Chrome Master Preferences"
echo "`date +"%a %b %d %X"` `hostname`: Google Chrome Master Preferences file created"
# Now that file has been created, set permissions on the file and copy it to the proper directory
/usr/sbin/chown root:admin "/tmp/Google Chrome Master Preferences"
/bin/chmod 644 "/tmp/Google Chrome Master Preferences"
/bin/cp -Rp "/tmp/Google Chrome Master Preferences" "/Library/Google/Google Chrome Master Preferences"
echo "`date +"%a %b %d %X"` `hostname`: Google Chrome Master Preferences moved into place"
# Test if we have the Google Chrome Default directory in /Application Support already, if not create it.
if [ ! -d "$UserTempEng/Library/Application Support/Google/Chrome/Default" ]; then
    mkdir -p "$UserTempEng/Library/Application Support/Google/Chrome/Default"
fi
/bin/cp -Rp "/tmp/Google Chrome Master Preferences" "$UserTempEng/Library/Application Support/Google/Chrome/Default/Preferences"
# Set the permissions appropriately
chown -R root:wheel "$UserTempEng/Library/Application Support/Google"
chmod 755 "$UserTempEng/Library/Application Support/Google"
echo "`date +"%a %b %d %X"` `hostname`: Google Chrome User preferences set"

mgshepherd
Contributor

Thanks for the helpful script @rcram however I don't see in your script any mention of creating the "First Run" file. Does your script not need this? When I test your script I'm getting the "Welcome to Google Chrome" when I first launch it.

I'm kinda frustrated with Chrome(surprise, surprise), I've been going back and forth from using a Master Preference file to the MobileConfig file. Just when I almost get everything the way I like it one thing doesn't work right.

rcram
New Contributor

I feel your pain @mgshepherd, Chrome is a tricky beast. I used to run out a FirstRun file in a separate part of my provisioning script. The latest versions of Chrome respond very oddly to this file in my environment however. As of the release of Chrome 58 I only use the following in my preference JSON:

"skip_first_run_ui": true, -This doesn't work in isolation. I am also passing show_welcome_page=false in one of the config profiles below, please see @mgshepherd's post on his solution to suppress the first run window.

I toss it into the Distribution section of the previously posted JSON and it seems to be working.
That being said I also lean of a couple of config profiles to get the full managed version of Chrome my school district requires. Basically, I do the following:
1. JSON to manage initial preferences *I apologize for not posting my full JSON, I used a default one that was easy to modify to get the effect requested as opposed to one I had to scrub of school related info, same goes for my full provisioning script
2. Config profile to whitelist an extension we use for SSO
3. Config profile we use to mandate no incognito mode
4. Config profile we use to mandate no password syncing
5. Config profile we use to blacklist extensions that do not fit our network use guidelines

mgshepherd
Contributor

@rcram : I tried setting "skip_first_run_ui" to true but that didn't work for me. After experimenting with the Profile Config route I was able to find that the following "metrics_reporting": false, put into the JSON file suppresses the "Welcome to Google Chrome" window. Please let me know otherwise, right now I'm a very happy person.

mgshepherd
Contributor

Opps, I spoke too soon. As I tested more using the "metrics_reporting" in the Master Preferences file, it seemed to start ignoring it so I put it back into the Config Profile plist file to lock down this option. It is now suppressing the "Welcome to Google Chrome" popup on first start.

If you're interested there's some good info about this from this guys post that pointed me in the right direction:

http://www.amsys.co.uk/2016/02/stop-first-run-messages-in-google-chrome/
http://www.amsys.co.uk/2017/02/chrome-first-run-messages-revisited-added-profiles/

rcram
New Contributor

@mgshepherd: Interesting, in isolation my JSON doesn't do what it is supposed to do. However, I am also passing show_welcome_page=false in the config profile I use to mandate no password syncing. However, that is just a leftover from when I first put together the configuration. It has long been reported that the setting doesn't work. I am going back over my deployment scripts because I have no welcome window on devices I am provisioning/re-imaging.