Posted on 03-10-2017 04:49 AM
Hello,
Something that bugs me about our inventory is we are not collecting clear user information so when I run a report its really hard to identify users without a further look up on one of our internal systems.
Our Macs are AD bound and login is an assigned 4 letters and 3 numbers combination which have no reference to a users real name and this what I see in a JSS report.
What is a good way to capture a users first name/last name and email address? We don't use Apple mail but MS Outlook which the users setups if that helps.
Posted on 03-10-2017 05:04 AM
We use the following Update Inventory script in most policies instead of the built-in Maintenance payload Update Inventory option:
#!/bin/sh
echo "*** Updating inventory ***"
# Get the logged in users username
loggedInUser=$(stat -f %Su "/dev/console")
echo "Running inventory update for ${loggedInUser} ..."
if [ ${loggedInUser} == "root" ] || [ ${loggedInUser} == 'YourLocalAdminAccountUsernameGoesHere' ] ; then
/usr/local/jamf/bin/jamf recon
echo "Finished running inventory update"
else
# Run recon, submitting the users username which as of 8.61+ can then perform an LDAP lookup
/usr/local/jamf/bin/jamf recon -endUsername ${loggedInUser}
echo "Finished running inventory update for ${loggedInUser} ..."
fi
exit 0
Posted on 03-10-2017 05:06 AM
If you have an LDAP server setup in the JSS you can pull the info using jamf recon -endUsername @@@@@. There is a 2015 JNUC video "Solving real-world problems from the command line" or something like that. It explains how to pull the currently logged in user and send that to the JSS with the recon command.
Posted on 03-10-2017 05:07 AM
You could test this in Terminal by issuing the following two commands:
loggedInUser=$(stat -f %Su "/dev/console")
… then …
/usr/local/jamf/bin/jamf recon -endUsername ${loggedInUser}
Then validate that the JSS shows the expected user information.
Posted on 03-10-2017 05:46 AM
Great responses. Thanks :)
Posted on 02-19-2021 12:19 PM
I'm only able to lookup via email address, but my script to automatically assign users to machines gets loggedinusername, which is usually first initial last name; results in no lookup.
Anyone find a way around this?