Create Local Account based on Assigned User

akw0045
New Contributor III

Basically, I want to auto create a local user account based on who I assign the device to in Jamf (assigned user area pictured below). I would give a generic password initially and have the client log into Enterprise Connect or the SSO extension to sync the password with their company account.

Is there a way to do this? Or would I be better served just looking at NoMad Login or Jamf Connect Login?
22c6aca891a5402eb8fa49d3cd42ff43

1 REPLY 1

dan-snelson
Valued Contributor II

@akw0045 You should be able to use the Classic API to look up the assigned username from the Jamf Pro computer record with something like …
../../JSSResource/computers/match/${computerSerialNumber}

… the following snippets may help:

computerSerialNumber=$( /usr/sbin/system_profiler SPHardwareDataType | grep Serial | /usr/bin/awk '{print $NF}' )
jamfProCompID=$( /usr/bin/curl -s -u ${apiUsername}:${apiPassword} ${jamfProURL}/JSSResource/computers/serialnumber/${computerSerialNumber}/subset/general | /usr/bin/xpath "//computer/general/id/text()" )

Then you can use sysadminctl or the JAMF binary to create the account:
/usr/local/bin/jamf createAccount -username ${username} -realname ${realname} -password "${password}" -home "/Users/${username}" -admin -suppressSetupAssistant