Skip to main content
Jamf Nation, hosted by Jamf, is the largest Apple IT management community in the world. Dialog with your fellow IT professionals, gain insight about Apple device deployments, share best practices and bounce ideas off each other. Join the conversation.

Renaming Computer Issues

I am using a simple AppleScript here to rename our computers before they get bound to AD. The computer name changes via the script, but as soon as it "Checks in" the names change back to MacBook Air. Occasionally it works fine and does not change back, but there is no rhyme or reason as to why. I have verified that NONE of my policies have the "Reset Computer Names " under the Maintenance Policy checked.

These are brand new machines never before logged in.

ComputerName=`/usr/bin/osascript << EOT
tell application "System Events"
    set ComputerName to text returned of (display dialog "Please Input New Computer Name" default answer "" with icon 2)
end tell
#Set New Computer Name
echo $ComputerName
/usr/sbin/scutil --set ComputerName "$ComputerName"
/usr/sbin/scutil --set LocalHostName "$ComputerName"
/usr/sbin/scutil --set HostName "$ComputerName"
echo "Rename Successful"
dscacheutil -flushcache
jamf recon
exit 0
Like Comment
Order by:
SOLVED Posted: by ShaunRMiller83

I know you mentioned you checked your policies but do you happen to have a Login Window Config Profile?

In that Config Profile payload is an option to "Set Computer Name to Computer Record Name"

Also have a close look at your other Config Profiles as well. I have been bit a few times where JAMF deploys a config profile with a "hidden" unrelated setting and causes some havoc.

SOLVED Posted: by ammonsc

I think you will need to change the computer name with the jamf binary command instead.

jamf setComputerName -name "$ComputerName"

SOLVED Posted: by ammonsc

We use the following script


NewComputerName="$(osascript -e 'Tell application "System Events" to display dialog "Enter the Asset ID Number:" default answer ""' -e 'text returned of result' 2>/dev/null)"

jamf setComputerName -name "$NewComputerName"

jamf recon -assetTag "$NewComputerName"
SOLVED Posted: by arepko

We do have a Login Window Config Profile! Thought for sure it would be this! But... verified that it is Not checked as well.

Verified the rest of our Config profiles as well. None of them have any settings for the name.

Going to RE-double check all of the policies again.

SOLVED Posted: by arepko

ammonsc - I'll give that a go and see if it holds any better for us.