Create local user account based on computer location in jss

nicholas_lythal
New Contributor II

Is there a way to to create a local user account based on the location data of the computer in jss?

I was hoping I would be able to use a create account policy and use the payload variables $USERNAME and $REALNAME in the appropriate fields, but these only work in configuration profiles.

Here's the situation I'm facing: We've got roughly 120 macbooks getting hand out to students as 1to1 devices. The students in question range in age from 8 - 10 and we'd like to avoid having to go through the setup assistant with each class. The local user account is the only aspect of the device that would be unique for each student and is the only part of the setup assistant would need to use.

I was thinking it would be easier to have account created before we give the device to the student and rather than manually create the account on each computer, just assign the computer to each student in jss and then have the account automatically created with the correct name based on this data via a policy/script etc.

Is there anyway to do this?
Thanks

1 REPLY 1

mm2270
Legendary Contributor III

You could do it via the API. In other words, once the Mac is enrolled in the JSS and has a username assigned to it manually in the JSS, have a script run that causes the Mac to check its own record in the JSS, either by its MAC address (easiest) or some other criteria, like the computer name. You can parse out the username assigned to it from the xml the API command pulls down, then, if the Mac is already bound to your directory service, like AD, you could pull all the relevant information from AD about that account into variables and use it in a script to create the account.
Or, if you only want to create a local account (not AD/directory based), just use the jamf binary with the account name assigned to the Mac in something like:

jamf createAccount -username $username -realname $FullName -home /Users/$username -shell /bin/bash

You may also want to assign the password with the -password flag in the above line.
Do jamf help createAccount in Terminal for more information on that.