Posted on 04-29-2020 07:34 AM
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.
Posted on 04-29-2020 09:49 AM
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).
Posted on 04-29-2020 10:23 AM
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
Posted on 04-29-2020 10:40 AM
Apple has a great guide for zero touch enrollment. I can't share the doc but you can ask apple for it.
Posted on 04-29-2020 11:48 PM
Thank you I will check the script and will also check what Apple has to offer.
Posted on 04-30-2020 01:29 AM
This script really works nice. Thanks.
Posted on 08-10-2021 02:00 PM
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?