Posted on
09-26-2019
10:42 AM
- last edited
Tuesday
by
kh-richa_mig
Does anyone have a script that they use to reset Google Chrome user data?
I found something similar for Safari at:
https://github.com/palantir/jamf-pro-scripts/blob/master/scripts/Reset%20Safari.sh
But couldn't find anything similar for Google Chrome.
I found a thread about this on Jamf Nation here but since the script would run with Casper admin I'm not sure that would work for me.
I imagine I could probably adapt the Safari script for Google Chrome as well...
I plan to distribute via a Self Serve policy with Jamf Pro.
Posted on 08-18-2022 08:41 AM
I was looking for the same so I edited the one you linked and made this one.
#!/bin/bash
###
#
# Name: Reset Chrome.sh
# Description: Resets all Chrome user data to defaults for the currently
# logged-in user.
# Created: 2022-08-18
# Version: 1.0
########## variable-ing ##########
killall "Google Chrome"
loggedInUser=$(/usr/bin/stat -f%Su "/dev/console")
loggedInUserHome=$(/usr/bin/dscl . -read "/Users/$loggedInUser" NFSHomeDirectory | /usr/bin/awk '{print $NF}')
userLibrary="$loggedInUserHome/Library"
uuid=$(/usr/sbin/system_profiler SPHardwareDataType | /usr/bin/awk '/Hardware UUID/ {print $NF}')
preferencesToReset=(
"$userLibrary/Caches/com.google.Chrome"
"$userLibrary/Caches/Google"
"$userLibrary/Application Support/Google/Chrome"
"$userLibrary/Preferences/com.google.Chrome.plist"
)
########## main process ##########
# Delete Chrome preference files.
echo "Deleting Chrome preference files to reset to system default..."
for chromePref in "${preferencesToReset[@]}"; do
if [ -e "$chromePref" ]; then
/bin/rm -rv "$chromePref"
fi
done
exit 0