Skip to main content
Question

Outlook email address extension attribute not working

  • November 3, 2021
  • 1 reply
  • 5 views

Forum|alt.badge.img+4

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

pete_c
Forum|alt.badge.img+16
  • Honored Contributor
  • November 3, 2021

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).