There is currently not a way of naming devices within the pre-stage enrollment. I have a script that sets the computer name based on the username upon first startup.
For computers we can automate names with a script but I assume we get to do it via a pre-stage enrollment on mobile devices since there isn't another automated way.
Sure thing it's on my GItHub.
The script can be pretty simple it just depends on your naming scheme. We like to use first initial last name to make it easy, so we pull that from the user full name. Then we set the computer name with the JAMF framework.
My script then uses CocoaDialog to ask the user (presumably an IT tech) which department to put the computer into and sets that using the JAMF framework.
Then we run a policy and recon refresh so software and printers install and the IT tech can install anything else via Self Service.
There's a few issues I need to investigate. One, I've heard using the JAMF framework to set the computer name isn't identical to using scutil three times.
sudo scutil --set ComputerName "newname" sudo scutil --set LocalHostName "newname" sudo scutil --set HostName "newname"
Secondly, I haven't added commands to the script to set system updates to install and to install any pending updates. I'll need to play with that to make the startup, see an update, install an update, continue where enrollment left off routine work well.
@adamcodega we have a lot students with the same first initial and last name. How can we change the line that pulls the first initial to pull the full first name instead? I've been trying to figure this out and can't. This is the line below that I'm referring to. Thanks!
finitial="$(echo $name | head -c 1)"
@gregleeper Head is being used to take out the first byte in the variable, meaning the first letter of the first name.
If you look at last name variable, we are using cut, telling it that a space is the delimiter with -d, and asking it to cut and then show us the second value, because we used -f 2
If you use -f 1 you'll get the first value instead, getting you the first name.
fn="$(echo $name | cut -d -f 1)"