Hi Nation!
I've been at it trying to run an AppleScript via policy in Jamf. The script is supposed to mount an smb share with the standard username/password prompt that you get with CMD+K. Below is a snippet of the script, with a debug dialog just to see that the conditionals work fine:
tell application "Finder"
if not (disk loggedinuser exists) then
tell application "Finder"
mount volume "smb://<ip-address>" as user name loggedinuser
display dialog "Disk mounted!"
end tell
end if
end tell
The problem here is that it works if I execute the check-in with sudo jamf policy, but if I trigger it via login or network state change, the script runs fine and displays the dialog but it doesn't actually run anything.
Now, from what I've read it sounds like user-initiated trigger and event-initiated trigger run as different users. Could someone explain to me why it doesn't work with event-triggered script and also if someone has a solution for this?
Thanks,
Sam