Posted on 08-13-2018 09:31 AM
App works find with ARD but is mostly failing on all machines the policy is scoped too. Running High Sierra, any info would be helpful. Thanks.
osascript -e 'tell application "System Events" to make login item at end with properties {path:"/Applications/myapp.app", hidden:false}'
Trying to add item to login item list.
Posted on 08-13-2018 09:35 AM
That might be a per user setting.
Posted on 08-14-2018 04:44 AM
ARD can run scripts as the logged in user. Jamf can't, unless you specify the user in your script.
Posted on 08-16-2018 11:04 AM
how do i specify user in this script, thanks
Posted on 08-16-2018 11:59 AM
Try this:
#!/bin/bash
loggedInUser=$(/usr/bin/python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "
");')
echo "Adding login item for $loggedInUser"
sudo su - "$loggedInUser" -c "osascript -e 'tell application "System Events" to make login item at end with properties {path:"/Applications/Firefox.app", name:"Firefox", hidden:false}'"
exit 0