Jamf Connect computer name scheme
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 07-19-2022 04:56 AM
Is it possible to have a default name scheme so all our newly deployed Macs will have the same kind of name?
Maybe something with numbering? MAC-01, MAC-02 etc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 07-19-2022 08:42 AM
First, you need to decide what you want your name scheme to be. Then you need to design a user experience for the first setup of your systems. I highly recommend using DEPNotify. You can customize it to create a naming scheme for your machines. Honestly, something containing the serial number makes the most sense to me, but there are tons of options out there.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 07-19-2022 11:14 AM
As @bwoods said you need to work on a naming convention first. I normally use the Serial Number of the device as that is 100% guaranteed to be unique, and directly associated with the device.
This is the script I use for out of compliance devices. It uses JAMF Helper to tell the user the hostname of the device is changing, you can remove that entire function if you just want to do it. For new devices I used a trimmed down version of this script that runs with our configuration, totally hands off and no need for user interaction. No need for 3rd party tools, everything is either native to macOS or comes with JAMF.
#!/bin/bash
#*=============================================================================
#* Created:
#* Author:
#*=============================================================================
#* Purpose: Alert Users of name name change and alloe them to perform changes.
#*=============================================================================
#* REVISION HISTORY
#*=============================================================================
#* Date:
#* Author:
#* Issue:
#* Solution:
#*=============================================================================
#* SCRIPT NOTES
#*=============================================================================
#* This user alert script should be paired with the (any image you want)
#* package available in JAMF in order to polpulate the Regions icons used in
#* the script. Set this script to run after the icons have installed.
#*=============================================================================
#* VARIABLES
#*=============================================================================
serialnumber=$(system_profiler SPHardwareDataType | awk '/Serial/ {print $4}')
windowType="utility"
## utility: creates an Apple "Utility" style window. Persisten message that has requires an action. [RECOMENDED]
## hud: creates an Apple "Heads Up Display" style window. Simple alert window, which can return false feedback if computer is locked.
## fs: creates a full screen window the restricts all user input. Remote access must be used to unlock machines in this mode.
icon="/path/to/image.png"
title="Computer Name Change"
alignDescription="left"
alignHeading="center"
timeout="0" ## Set desired timeout time in secconds
description="Due to new hardware naming standards, your computer will need to be renamed to match your serial number: $serialnumber
Computer name changes will be enforced begining on {date you want for policy enforcement}" ## Write message here
button1="Postpone"
button2="Rename"
defaultButton="0"
cancelButton="2"
#*=============================================================================
#* MAIN SCRIPT
#*=============================================================================
## Ensure Assets are installed
if [ ! -e "$icon" ]
then
sudo jamf policy -event installAlertIcons ## If it doesn't exits, download Assets
fi
## Present user alert
jamfHelper="/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper"
userChoice=$("$jamfHelper" -windowType "$windowType" -lockHUD -title "$title" -timeout "$timeout" -defaultButton "$defaultButton" -cancelButton "$cancelButton" -icon "$icon" -description "$description" -alignDescription "$alignDescription" -alignHeading "$alignHeading" -button1 "$button1" -button2 "$button2")
if [ "$userChoice" == "0" ]
then
echo "User clicked on $button1"
elif [ "$userChoice" == "2" ]
then
echo "User clicked on $button2"
sudo jamf policy -event alias 2> /dev/null
sudo jamf policy -event notificationChangeReboot
exit 0
fi
