Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save smashism/080094a86dbc257c3e0d88ec21cfa8cf to your computer and use it in GitHub Desktop.
Save smashism/080094a86dbc257c3e0d88ec21cfa8cf to your computer and use it in GitHub Desktop.
Designed for Jamf Pro computer extension attribute configuration. Checks for presences of com.apple.siri.generativeassistentsettings in the local preferences of the logged in user and reports the status. For macOS 15.2 and later.
#!/bin/bash
# determine if current user has opted-in for Generative Assistant settings for Apple Intelligence & Siri on macOS 15.2 or later
# ekw 2024-10-24
# built at time of macOS 15.2 beta 1
currentUser=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ { print $3 }' )
# global check if there is a user logged in
if [ -z "$currentUser" -o "$currentUser" = "loginwindow" ]; then
echo "no user logged in, cannot proceed"
exit 1
fi
OLDIFS=$IFS
IFS='.' read osvers_major osvers_minor osvers_dot_version <<< "$(/usr/bin/sw_vers -productVersion)"
# restore IFS to previous state
IFS=$OLDIFS
# Check to see if the Mac is reporting itself as running macOS 15
if [[ ${osvers_major} -ge 15 ]]; then
if [ -f "/Users/"$currentUser"/Library/Preferences/com.apple.siri.generativeassistantsettings.plist" ] ; then
chatGPTstatus=$(/usr/bin/defaults read /Users/"$currentUser"/Library/Preferences/com.apple.siri.generativeassistantsettings.plist isEnabled)
if [ $chatGPTstatus = "1" ] ; then
echo "<result>Enabled</result>"
elif [ $chatGPTstatus = "0" ] ; then
echo "<result>Disabled</result>"
else
echo "<result>Not configured</result>"
fi
else
echo "<result>Not configured</result>"
fi
exit 0
else
echo "<result>Ineligible</result>"
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment