-
Notifications
You must be signed in to change notification settings - Fork 13
/
MAU_CheckMethod.sh
33 lines (27 loc) · 920 Bytes
/
MAU_CheckMethod.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
#!/bin/zsh
## Extension Attribute to report which mode Microsoft AutoUpdate is using
## 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
HowToCheck=$(getPrefValue "com.microsoft.autoupdate2" "HowToCheck")
if [ "$HowToCheck" = "" ]; then
echo "<result>AutomaticDownload (inferred)</result>"
else
echo "<result>$HowToCheck</result>"
fi
else
echo "<result>Not installed</result>"
fi
exit 0