Script to rename laptops

erickm
New Contributor

Hi team,

I am looking for a script to deploy via policy. The naming convention we have adopted is (department, login user, -L). So for example a laptop name would be ITUSER-L. I have created a static group called IT but can't figure our how to make the script to collect the department information. We use jamf connect (Okta as our IdP), if there is an easier way to do this via jamf connect that would work too. Thanks.

4 REPLIES 4

Andreas42
New Contributor II

Hi erickm,

you may push the department info to the client using a configuration profile with paload variables, see https://docs.jamf.com/10.34.0/jamf-pro/documentation/Computer_Configuration_Profiles.html how to do it.

If you use "tld.company.macclient" as preference domain for the Profile and "DepartmentName" as key, your script can then read the information using

defaults read /Library/Managed\ Preferences/tld.company.macclient.plist DepartmentName

The computer name can be set in your script using jamf setComputerName (see https://docs.jamf.com/10.34.0/jamf-pro/documentation/Renaming_a_Computer.html)

Kind regards

Andreas

Andreas Probst

erickm
New Contributor

Thanks Andreas42. I will try that and report back on the thread.

erickm
New Contributor

Hi @Andreas42 

Sorry I am a little confused, when you say "tld.company.macclient" are you referring to my domain? not familiar with tld, I might be misunderstanding. Thanks.

Andreas42
New Contributor II

Hi erickm,

I refer to the preference domain used in the configuration profile.

kind regards

 

Andreas42

 

Andreas Probst