Posted on 10-25-2023 12:20 PM
Has anyone made a script or profile to rename devices in jamf pro? right now, there is onl;y 1 option (within pre-stage enrollment) and i'd like to have a 2nd. my goal it to name the phones using a prefix of P followed by the serial, and a prefix of a T for the ipads.
anyone doing something like this?
Posted on 10-25-2023 12:35 PM
I don't manage iOS devices in Jamf, just Macs but here's what I'm using for renaming Macs by adding a prefix of "M-" before the serial number. Maybe it will help lead you in the right direction?
#!/bin/sh
prefix="M-"
serial=`system_profiler SPHardwareDataType | awk '/Serial Number/ { print $4 }'`
sudo /usr/sbin/scutil --set ComputerName "${prefix}${serial}"
sudo /usr/sbin/scutil --set HostName "${prefix}${serial}"
sudo /usr/sbin/scutil --set LocalHostName "${prefix}${serial}"
sleep 5
exit 0
Posted on 10-25-2023 05:49 PM
Hello, how could this script be modified to use M- but only the last 7 characters of the serial number?
Posted on 10-26-2023 10:33 AM
Grep the serial number.
Posted on 10-26-2023 08:28 PM
This script should do what you asking for
#!/bin/sh
SerNum=$(ioreg -rd1 -c IOPlatformExpertDevice | awk -F'"' '/IOPlatformSerialNumber/{print $4}')
lastSeven="${SerNum: -7}"
jamf setComputerName --name $lastSeven -prefix "M-"
Posted on 08-07-2024 09:01 AM
@mickgrant
https://www.bing.com/search?q=api+script+to+rename+device+building+name+jamf&qs=n&form=QBRE&sp=-1&gh...
Please let me know what u suggest on this
Posted on 08-07-2024 09:04 AM