Skip to main content
Question

Grab user information from Local Account

  • November 9, 2016
  • 2 replies
  • 15 views

Forum|alt.badge.img+7

Hey folks,
Was wondering if there is a way to automatically upload Local user information from the machine to JSS?

The Mac already collects Full Name and Short Name, and we just want it to be able to upload that to JSS so the User and Location fields get populated with Full Name and Shortname

Thoughts?

Thanks in advance!

2 replies

stevewood
Forum|alt.badge.img+38
  • Hall of Fame
  • November 9, 2016

@mitulpatel2003 sure you can do this. You'll need to use dscl to pull the info from the local machine and the jamf binary with the recon verb to do so. This is a rough, not tested, script you could use. Just one way to do it.

#!/bin/bash
loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`
firstName=`dscl . read /Users/${loggedInUser} FirstName | /usr/bin/awk '{ print $2 }'`
lastName=`dscl . read /Users/${loggedInUser} LastName | /usr/bin/awk '{ print $2 }'`
fullName="${firstName} ${lastName}"
shortName=`dscl . read /Users/${loggedInUser} RecordName | /usr/bin/awk '{ print $2 }'`

jamfCall="jamf recon -endUsername ${shortName} -realname '${fullName}'"

${jamfCall}

Forum|alt.badge.img+7
  • Author
  • New Contributor
  • November 10, 2016

@stevewood Thanks so much! going to try this out later today!
Thanks again!