Skip to content

Instantly share code, notes, and snippets.

@smithjw
Created March 30, 2022 22:44
Show Gist options
  • Save smithjw/ff4283863367f2fd10c2df0d5be5b7f2 to your computer and use it in GitHub Desktop.
Save smithjw/ff4283863367f2fd10c2df0d5be5b7f2 to your computer and use it in GitHub Desktop.
Jamf EA - Microsoft Office Insider Status
#!/bin/bash
plistbuddy=/usr/libexec/PlistBuddy
logged_in_user=$( scutil <<< "show State:/Users/ConsoleUser" | awk '/Name :/ && ! /loginwindow/ { print $3 }' )
plist="/Users/$logged_in_user/Library/Preferences/com.microsoft.autoupdate2.plist"
field_name=":ChannelName"
if [[ -f "$plist" ]]; then
# Check if user is on Beta or Preview Track
field_value=$($plistbuddy -c "Print $field_name" "$plist")
if [[ -n "$field_value" ]]; then
echo "<result>$field_value</result>"
else
echo "<result>Current Channel</result>"
fi
else
echo "<result>Plist Not Found</result>"
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment