Skip to main content
Solved

Computer name changes reverting?


Forum|alt.badge.img+6

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?

Best answer by ryan_ball

@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 original
Did this topic help you find an answer to your question?

9 replies

Forum|alt.badge.img+18
  • Contributor
  • 475 replies
  • Answer
  • October 29, 2020

@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.


Forum|alt.badge.img+4
  • New Contributor
  • 12 replies
  • October 30, 2020

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
Forum|alt.badge.img+9
  • Contributor
  • 155 replies
  • October 31, 2020
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

Forum|alt.badge.img+6
  • Author
  • Contributor
  • 15 replies
  • November 4, 2020

Thank you all!


Forum|alt.badge.img+3
  • New Contributor
  • 2 replies
  • November 10, 2020

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/


Forum|alt.badge.img
  • New Contributor
  • 1 reply
  • November 23, 2021

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+. 


Forum|alt.badge.img+4
  • Contributor
  • 10 replies
  • October 5, 2023
ryan_ball wrote:

@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.


Forum|alt.badge.img
  • New Contributor
  • 1 reply
  • October 16, 2023
snowfox wrote:
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

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


stephaniemm77
Forum|alt.badge.img+5

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


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings