Outlook email address extension attribute not working
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 11-03-2021 07:31 AM
Have a script that does the following:
- Checks to see if Microsoft Outlook is installed. If it is..
- Utilizes applescript to determine if Outlook is running. If it is ..
- Tell me the username of the microsoft exchange account is being used.
- If Outlook isnt running, it will report back "Offline"
Tested it as a regular script and works as intended but in in JAMF it doesnt display anything. Neither the email address nor 'offline'. Any thoughts on what isnt right?
#!/bin/bash
if [ -e "/Applications/Microsoft Outlook.app" ]; then
useremail=$(/usr/bin/osascript <<'EOF'
if application "Microsoft Outlook" is running then
tell application "Microsoft Outlook"
user name of every exchange account
end tell
else
return "Offline"
end if
EOF)
Echo "<result>$useremail</result>"
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2021 08:29 AM - edited 11-03-2021 08:31 AM
Remember that scripts run as root by default in Jamf. I'm not enough of an AS expert to know if you could get that part of the script to look into userspace, but you could run the entirety of the script (not just the AS) as the logged-in user, ie
currentUser=$(stat -f %Su /dev/console)
or similar (don't parse ls).
