Hi There,
Currently i am using https://github.com/talkingmoose/Outlook-Exchange-Setup-5 to configure the Exchange account for an on premise server. I am trying to authenticate/grab the details of the logged in user instead of via AD or O365.
However, it seems as though when this script gets run from JAMF, it thinks the logged in user is Root/System Administrator, as i believe JAMF runs/deploys the script as root.
Is there a way of scripting launching the apple script as the actual logged in user of the account and not the elevated account?
This is how i call it up:
#!/bin/sh
# get the current user
loggedInUser=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ && ! /loginwindow/ { print $3 }' )
# test if a user is logged in
if [ -n "$loggedInUser" ]; then
# get the uid
uid=$(id -u "$loggedInUser")
# do what you need to do
launchctl asuser "$uid" osascript /Users/Shared/Outlook/Outlook\\ Exchange\\ Setup\\ 5.5.4.scpt
fi
exit 0
Thanks in advance!
