Worklet - Chrome Silent Install (Mac OS)

This Worklet will install Chrome silently on end-user devices. This is helpful if you push extensions and bookmarks via Google Workspace (this requires user signs into Chrome with their work email). Helpful for onboarding if your company prefers Chrome over other browsers.

Evaluation code:

if [[ -d "/Applications/Google\ Chrome.app" ]]; then
  exit 1
else
  exit 0
fi

Remediation code:

#!/bin/bash

temp=$TMPDIR$(uuidgen)

mkdir -p ${temp}/mount

echo "Downloading Chrome..."
if curl https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg > ${temp}/1.dmg; then
    echo "Downloaded Chrome"
else 
    echo "Something went wrong downloading" && exit 1
fi

echo "Mounting and installing..."
yes | hdiutil attach -noverify -nobrowse -mountpoint ${temp}/mount ${temp}/1.dmg
cp -r ${temp}/mount/*.app /Applications

echo "Detaching..."
hdiutil detach ${temp}/mount

echo "Cleaning up..."
rm -r ${temp}
2 Likes