Hello JAMF peeps,
I'm running into a wall on this. I'm trying to create a script that will run some policies after a user logs in after the computer has been imaged. Pretty much a first boot / log in script.
I created a launchAgent using Lingon X and chose the option "At startup and when saving." I packaged it with Composer and followed the steps in this thread to add a post flight script: https://www.jamf.com/jamf-nation/discussions/15401/is-there-a-way-to-deploy-a-launchagent-to-several-machines-through-jss-or-casper-remote
However, it doesn't look like the launchAgent is loading. I'm currently installing it on my test computers through Casper Remote. But essentially I want the .pkg to be installed during Casper Imaging and work once the user gets their computer and logs in.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:/usr/local/MacGPG2/bin:/usr/local/sbin</string>
</dict>
<key>Label</key>
<string>com.companyname.jamf.firstLogin</string>
<key>LaunchOnlyOnce</key>
<false/>
<key>ProgramArguments</key>
<array>
<string>/Users/Shared/firstLogin.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StartOnMount</key>
<false/>
</dict>
</plist>
Here's the script that it's pointing to:
#!/bin/sh
# Grab current user
user=`ls -la /dev/console | cut -d " " -f 4`
# If the logged in user is not Admin, do this...
if [ $user != admin ]; then
# Run firstLogin trigger policies
sudo jamf policy -event firstLogin
# Wait 10 seconds to make sure everything runs
sleep 10
# Grab current user
echo "Deleting launch agent and script."
rm /Users/Shared/firstLogin.sh
rm /Library/LaunchAgents/com.companyname.jamf.firstLogin.plist
exit 0
fi
Any thoughts?