-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathWebEx_Add-in_State.sh
46 lines (40 loc) · 1.27 KB
/
WebEx_Add-in_State.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
44
45
46
#!/bin/zsh
#set -x
## Extension Attribute to report if the Cisco WebEx Scheduler add-in is present in Outlook for Mac
WEBEXID="7a91e319-a65d-4ceb-909b-12203561dbf5"
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
}
## Main
LoggedInUser=$(GetLoggedInUser)
GetHomeFolder "$LoggedInUser"
PREFSFILE="$HOME/Library/Containers/com.microsoft.Outlook/Data/Library/Preferences/com.microsoft.Outlook.plist"
if [ -e "$PREFSFILE" ]; then
IDSCACHE=$(defaults read "$PREFSFILE" MoeIdsCache | grep "$WEBEXID")
if [ $? = 0 ]; then
# We found the ID in the cache, so report that the extension is loaded
echo "<result>Loaded</result>"
else
# We didn't find the ID in the cache, so report that the extension is NOT loaded
echo "<result>Not Loaded</result>"
fi
else
# We didn't find the Outlook preferences file so either Outlook is not installed or hasn't been run
echo "<result>Unknown</result>"
fi
exit 0