-
Notifications
You must be signed in to change notification settings - Fork 13
/
MAU_GuardTest.sh
33 lines (27 loc) · 970 Bytes
/
MAU_GuardTest.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 whether GuardAgainstAppModification is being used with 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
RetainClone=$(getPrefValue "com.microsoft.autoupdate2" "GuardAgainstAppModification")
if [ "$RetainClone" = "true" ]; then
echo "<result>Guard enabled</result>"
else
echo "<result>Guard disabled</result>"
fi
else
echo "<result>MAU not installed</result>"
fi
exit 0