Yet another Jamf Pro Extension Attribute which returns the status of Apple Intelligence

Background
After several pre-macOS 15.1 Apple Intelligence-related direct messages with Bob Gendler on the Mac Admins Slack, I was excited to read the official, well-timed Raising Your IQ on Apple Intelligence post.
Now, naturally, we’re curious to identify which of our opt-in Beta Testers has enabled Apple Intelligence.
Update: Behavior changes starting with macOS 15.3 (24D60)
For users new or upgrading to macOS [15.3], Apple Intelligence will be enabled automatically during Mac onboarding.
For those wishing to prevent this behavior, disabling the Intelligence pane in Setup Assistant may prove helpful:
com.apple.SetupAssistant.managed
<dict> <key>SkipSetupItems</key> <array> <string>Intelligence</string> </array> </dict>
Extension Attribute
The following script returns the status of Apple Intelligence for macOS 15.1 (and later):
- Pre-macOS 15.1
- Not Applicable; macOS ${osVersion}
- macOS 15.1 (and later)
- Not Configured
- Enabled (no Apple Account)
- Apple Account Enabled
#!/usr/bin/env zsh ################################################################################## # A script to collect the status of Apple Intelligence for macOS 15 (and later). # # # # Possible results: # # • Pre-macOS 15.1 # # • Not Applicable; macOS ${osVersion} # # • macOS 15.1 (and later) # # • Not Configured # # • Enabled (no Apple Account) # # • Apple Account Enabled # # # # Inspired by: # # https://boberito.medium.com/raising-your-iq-on-apple-intelligence-380933894340 # ################################################################################## autoload is-at-least RESULT="Not Configured" osVersion=$( sw_vers -productVersion ) if is-at-least 15.1 $osVersion; then lastUser=$( defaults read /Library/Preferences/com.apple.loginwindow.plist lastUserName ) testFile="/Users/${lastUser}/Library/Preferences/com.apple.CloudSubscriptionFeatures.optIn.plist" if [[ -f "${testFile}" ]] ; then mobileMeAccountID=$( /usr/libexec/PlistBuddy -c "print Accounts:0:AccountDSID" "/Users/$lastUser/Library/Preferences/MobileMeAccounts.plist" 2>/dev/null ) if [[ "${mobileMeAccountID}" == *"File Doesn't Exist"* ]]; then value=$( /usr/bin/defaults read "/Users/$lastUser/Library/Preferences/com.apple.CloudSubscriptionFeatures.optIn.plist" device 2>/dev/null ) if [[ "${value}" == "1" ]]; then RESULT="Enabled (no Apple Account)" else RESULT="Disabled" fi else value=$( /usr/bin/defaults read "/Users/$lastUser/Library/Preferences/com.apple.CloudSubscriptionFeatures.optIn.plist" "$mobileMeAccountID" 2>/dev/null ) if [[ "${value}" == "1" ]]; then RESULT="Apple Account Enabled" else RESULT="Disabled" fi fi fi else RESULT="Not Applicable; macOS ${osVersion}" fi /bin/echo "<result>$RESULT</result>"
Update: 04-Dec-2024
Detecting Apple Intelligence and ChatGPT Integration Status by Joel Bruner