-
Notifications
You must be signed in to change notification settings - Fork 13
/
New_Outlook.sh
41 lines (34 loc) · 966 Bytes
/
New_Outlook.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
#!/bin/zsh
## Extension Attribute to report whether a user is actively running New Outlook (aka Phoenix)
GetLoggedInUser() {
LOGGEDIN=$(/bin/echo "show State:/Users/ConsoleUser" | /usr/sbin/scutil | /usr/bin/awk '/Name :/&&!/loginwindow/{print $3}')
if [ "$LOGGEDIN" = "" ]; then
echo "$USER"
else
echo "$LOGGEDIN"
fi
}
GetHomeFolder() {
HOME=$(dscl . read /Users/"$1" NFSHomeDirectory | cut -d ':' -f2 | cut -d ' ' -f2)
if [ "$HOME" = "" ]; then
if [ -d "/Users/$1" ]; then
HOME="/Users/$1"
else
HOME=$(eval echo "~$1")
fi
fi
}
RunningPhoenix() {
PHOENIX=$(/usr/bin/defaults read "$HOME/Library/Containers/com.microsoft.Outlook/Data/Library/Preferences/com.microsoft.Outlook" IsRunningNewOutlook)
echo "$PHOENIX"
}
## Main
LoggedInUser=$(GetLoggedInUser)
GetHomeFolder "$LoggedInUser"
RunningNewOutlook=$(RunningPhoenix)
if [ "$RunningNewOutlook" = "1" ]; then
echo "<result>Yes</result>"
else
echo "<result>No</result>"
fi
exit 0