Skip to main content

Setting macOS computer name using IIQ API and Jamf Binary

  • May 17, 2024
  • 1 reply
  • 44 views
Setting macOS computer name using IIQ API and Jamf Binary
Forum|alt.badge.img

Hi everyone,

Just wanted to post this as it may be helpful, I developed a script today based off of another one that I found to name a Mac with information entered into Incident IQ assets. The script uses 3 variables $4, $5, and $6 which can be set in jamf pro.

$4 - iiq URL (https://YOURORG.incidentiq.com no backslash at end)

$5 - iiq API Token (Admin>Developer Tools>Create API Token)

$6 - Custom field ID for computer name in iiq (you may have to a little investigative work in the api to find this id)

Once the script is in place, create the asset in IIQ fill in the Asset Tag, S/N and your custom field for what you want to name your computer.

Either use jamf to run it or run directly on the mac, it will pull the serial number from the mac and use that to look up the device in IIQ and grab the result of the custom name field and stores it in a variable. 

Then it will again use the serial to pull the asset tag and stores it in a variable.

Next it uses the jamf binary to name the computer and then does a jamf recon to update the name and asset tag in jamf.

Finally it sets the host name and local host name.

If you don’t use jamf it would be a fairly easy task to remove the section that renames the computer with jamf and replace it with scutil --set computerName Instead.

https://github.com/sintichn/public-scripts/blob/main/setComputerNameFromIiq.bash

 

Hopefully this helps some folks out there!

1 reply

Kathryn Carter
Forum|alt.badge.img+18

@NSintich 870f058 district65 Thank you for sharing this with our Community! We love seeing what users develop and use within iiQ 😄