Machine Naming For Zero Deployment

New Contributor III

Hi i was wondering if any one could assist me with a issue , we are trying to automate machine names so when a machine enrolls it set the machine to our naming convention.
the two things my boss want to know can we script it to name the machine after the last machine or link it to paging file

for example what we want is a UK laptop would be UKLTMAC* if it was a IMAC it would UKDTMAC

IF any one has any ideas it would be a marvelous help as we are trying to move forward with our Zero Imaging


New Contributor III

To your base question: "can we script it?" Yes.   With that answered however, many more questions arise. Where would that naming information come from? Are you manually setting up PreStage Enrollment? Are you doing things on each Mac you want to then be automatically reflected in the name?

A script can access info about the computer running it. For one example, the following command will output the model identifier, which the script could then accordingly change to LT or DT: system_profiler SPHardwareDataType | awk '/Model Identifier/{print $NF}'

A script can get the IP address your network assigned it; is that sufficient to know what site it's being deployed into? It's a bit of a jump down the rabbit hole, but scripts can also use the API to access their own JSS inventory info. For example ...say you do a user-initiated enrollment, assign it to an LDAP user, which then makes the Building field contain a string which contains a country code... you could parse that out and include it in the Mac's name.

Lots of options. Certainly sounds possible.