Computer name changes reverting?

dlprentice
New Contributor III

Every time I change an erroneous computer name on Jamf through "Search Inventory" the name eventually reverts back to "David's MacBook Pro" or something.

Any ideas why this might be happening?

1 ACCEPTED SOLUTION

ryan_ball
Valued Contributor

@dlprentice Changing the computer record name in Jamf Pro will not actually change the Mac's local hostname. So when the Mac does a recon the next time, the computer record name in Jamf Pro will be updated to the current local Mac hostname.

What you probably want to do is rename the Mac in Jamf Pro, then set up a policy and use the Maintenance payload, and the "Reset Computer Names" option, then scope the computer to that policy and set it for once-per, at check-in.

View solution in original post

9 REPLIES 9

ryan_ball
Valued Contributor

@dlprentice Changing the computer record name in Jamf Pro will not actually change the Mac's local hostname. So when the Mac does a recon the next time, the computer record name in Jamf Pro will be updated to the current local Mac hostname.

What you probably want to do is rename the Mac in Jamf Pro, then set up a policy and use the Maintenance payload, and the "Reset Computer Names" option, then scope the computer to that policy and set it for once-per, at check-in.

I am doing this and still have device names revert back.

jpuebs
New Contributor III

We had a similar issue but ryan.ball is correct, it won't actually change the name of the computer. We had to run a script to rename all our hosts appropriately. Or you can do manual renaming with scutil commands:

scutil --set ComputerName

snowfox
Contributor III
sudo jamf help setComputerName                               

Usage:   jamf setComputerName [-target <target volume>] [-name <name>]
         [-useMACAddress] [-useSerialNumber] [-suffix <suffix>]
         [-prefix <prefix>] [-fromFile <path to file>]

     -target         The target drive to set the name on
     -name           The new name for the computer
     -useMACAddress      Generate the name using the MAC Address
     -useSerialNumber    Generate the name using the Serial Number
     -prefix         Add this prefix to the MAC Address or Serial Number
     -suffix         Add this suffix to the MAC Address or Serial Number
     -fromFile       The path to a CSV file containing the computer's MAC Address or Serial Number followed by the desired name

sudo jamf setComputerName -useSerialNumber -prefix MAC

sudo jamf recon   (to update the machine name on Jamf Pro once set locally)    

This command is smart enough to set it for:

Hostname
LocalHostname
Netbios Name

Abe00
New Contributor

@snowfox thanks for the Info but when I run that at the end of the name it adds "(null) " how would remove it? 

dlprentice
New Contributor III

Thank you all!

kevin_kolcz
New Contributor II

I'm a little late to this party, but I had the same issue when we switched over last year and needed an easier way to rename computers as purchased. Manually naming them wasn't really an option as we have over 1,000 computers.

I found the below and am currently using it. Once computer enrolls with jamf and checks in there is a script that runs and pulls a Google sheet with the serial and desired name. The computer renames itself, restarts, and the change sticks on both sides.

https://www.macblog.org/post/automatically-renaming-computers-from-a-google-sheet-with-jamf-pro/

carlomacias
New Contributor

hi, i'm new to jamf, but what I want to achieve right now is to change the computer name in jamf now+ and push to devices. Is this possible in jamf now+. 

stephaniemm77
Contributor II

I basically do this but i use a .csv uploaded within jamf, until recently this worked great. All of a sudden it stopped working and I have NO idea why. Here is my script, of course i removed username and password.

 

#!/bin/bash

## Enter the API Username, API Password and JSS URL here
apiuser=
apipass=
jssURL="https://quinnipiac.jamfcloud.com"

## Get the Mac's UUID string
UUID=$(ioreg -rd1 -c IOPlatformExpertDevice | awk -F'"' '/IOPlatformUUID/{print $4}')

## Pull the Asset Tag by accessing the computer records "general" subsection
Asset_Tag=$(curl -H "Accept: text/xml" -sku "${apiuser}:${apipass}" "${jssURL}/JSSResource/computers/udid/${UUID}/subset/general" | xmllint --format - 2>/dev/null | grep asset | sed -e 's/<[^>]*>//g')

echo "$Asset_Tag"

# Set Computer Name
sudo scutil --set HostName ${Asset_Tag}
sudo scutil --set LocalHostName ${Asset_Tag}
sudo scutil --set ComputerName ${Asset_Tag}

# Update Inventory
sudo jamf recon