Script to update computer name at check in

davidharbin
New Contributor

Hello,

I have not been able to figure out how to script in JAMF to have machines update their computer name at check-in. I'm aware of the "reset computer name" policy, but that won't work for what I'm trying to do going forward.

In short, I want my machines to update their computer name at check-in to; serialnumber-c

Any help? I'm running the latest version of Jamf, admin from MacOS, built of a Tomcat Apache Server.

2 REPLIES 2

emily
Valued Contributor III
Valued Contributor III

You should be able to modify this to work:
https://github.com/smashism/jamfpro-scripts/blob/master/set_computerName.sh

Adapt it by getting the serial number as a variable to pass instead, something like:
SerialNumber=$(system_profiler SPHardwareDataType | awk '/Serial/ {print $4}')

bjharper
New Contributor II

I have to vouch for this script and say it works flawlessly; thanks @emily for providing it!