Skip to main content
Question

Script to rename laptops

  • February 16, 2022
  • 4 replies
  • 20 views

Forum|alt.badge.img+3

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

Forum|alt.badge.img+1
  • New Contributor
  • February 16, 2022

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


Forum|alt.badge.img+3
  • Author
  • New Contributor
  • February 17, 2022

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


Forum|alt.badge.img+3
  • Author
  • New Contributor
  • April 8, 2022

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.


Forum|alt.badge.img+1
  • New Contributor
  • April 9, 2022

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.


Hi erickm,

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

kind regards

 

Andreas42