Computername in PreStage Enrollment

rels
New Contributor

Is it possible to Change the Computername of a Macbook within the PreStage Enrollment.
We want to add the Serialnumber to the Computername and want to block the possibility to change it.

6 REPLIES 6

Anonymous
Not applicable

Not sure if this helps, but we run a policy during the enrollment complete portion that adds initials and the serial #, then we have an on-going policy to keep the computer/host/etc name the same. It's not entirely polished but it keeps the computer name accurate.

As far as preventing a user from changing it, you could restrict Sharing preferences, but they could also use Terminal if they have admin. One method would be to run a policy/script that would match the Jamf computer name record so it will always match what you want or had set. My policy just sets the name at certain intervals (its not entirely polished or pretty, but think I may switch to the former suggestion).

LovelessinSEA
Contributor II

I run this as part of my enrollment script to rename the computer prior to binding to the AD. Doesn't prevent users from changing the name after the fact but like @randy.andersen said if the users have local admin privileges and access to sharing preferences they can change it.

#!/bin/sh

serial_number=`ioreg -l | grep IOPlatformSerialNumber|awk '{print $4}' | cut -d " -f 2`
/usr/sbin/scutil --set ComputerName $serial_number
/usr/sbin/scutil --set LocalHostName $serial_number
/usr/sbin/scutil --set HostName $serial_number

macbentosh
New Contributor III

Apple has a great guide for zero touch enrollment. I can't share the doc but you can ask apple for it.

rels
New Contributor

Thank you I will check the script and will also check what Apple has to offer.

rels
New Contributor

This script really works nice. Thanks.

big_mac_attack
New Contributor

Old topic but how did you guys get the script to work prior to AD binding? Not sure where or how to fit this in? Any ideas?