Have a script that does the following:
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>"
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).