Create Local Account based on Assigned User

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?


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 …

… 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