-
Notifications
You must be signed in to change notification settings - Fork 13
/
MAU_Channel.sh
43 lines (38 loc) · 1.5 KB
/
MAU_Channel.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/zsh
## Extension Attribute to report which update channel is being used by Microsoft AutoUpdate
## Functions
function getPrefValue { # $1: domain, $2: key
osascript -l JavaScript << EndOfScript
ObjC.import('Foundation');
ObjC.unwrap($.NSUserDefaults.alloc.initWithSuiteName('$1').objectForKey('$2'))
EndOfScript
}
function getPrefIsManaged { # $1: domain, $2: key
osascript -l JavaScript << EndOfScript
ObjC.import('Foundation')
$.CFPreferencesAppValueIsForced(ObjC.wrap('$2'), ObjC.wrap('$1'))
EndOfScript
}
## Main
if [ -d /Library/Application\ Support/Microsoft/MAU2.0/Microsoft\ AutoUpdate.app ]; then
ChannelName=$(getPrefValue "com.microsoft.autoupdate2" "ChannelName")
if [ "$ChannelName" = "External" ] || [ "$ChannelName" = "Preview" ]; then
echo "<result>Current Channel Preview</result>"
elif [ "$ChannelName" = "InsiderFast" ] || [ "$ChannelName" = "Beta" ]; then
echo "<result>Beta Channel</result>"
elif [ "$ChannelName" = "CurrentThrottle" ]; then
echo "<result>Monthly</result>"
elif [ "$ChannelName" = "Internal" ]; then
echo "<result>Microsoft</result>"
elif [ "$ChannelName" = "Dogfood" ]; then
echo "<result>Dogfood</result>"
elif [ "$ChannelName" = "Custom" ]; then
ManifestServer=$(getPrefValue "com.microsoft.autoupdate2" "ManifestServer")
echo "<result>Custom - $ManifestServer</result>"
else
echo "<result>Current Channel</result>"
fi
else
echo "<result>Not installed</result>"
fi
exit 0