Posted on 09-05-2018 07:12 AM
I have a configuration profile with the Login Window payload with the following settings under Login Window > Options.
When I deploy the profile I cannot edit the computer name under System Preferences > Sharing > Computer Name because its greyed out. In my understanding this should be the case when "Set computer name to computer record name" is ticked, but its not.
Am I missing something?
Posted on 09-05-2018 07:41 AM
You can set this from the Terminal:
sudo scutil --set ComputerName [computer name]
What that config profile setting should do is set the hostname to the same as how it is named in the JSS.
You can check if it has set that correctly by doing the following:
sudo scutil --get ComputerName
sudo scutil --get HostName
sudo scutil --get LocalHostname
ComputerName is the so-called “user-friendly” name for the Mac, it’s what will show up on the Mac itself and what will be visible to others when connecting to it over a local network.
HostName is the name assigned to the computer as visible from the command line, and it’s also used by local and remote networks when connecting through SSH and Remote Login.
LocalHostName is the name identifier used by Bonjour and visible through file sharing services like AirDrop
Posted on 09-05-2018 07:54 AM
This is relevant for me as well. We deploy +300 laptops and this year I had the same thing happen. The Computer Name is grayed out. I ran several scripts and it changed the Host Name, but the Computer Name did not change. Why is that important? If I have a machine that is not being recognized by ARD, the name (we include serial number) is how I can track it down.
So, like Pandrum, what did I do to mess it up? or better what is the fix?
Peace,
Tom
Posted on 09-06-2018 01:10 AM
@Tangentism Yes I know I can change the name with the scutil command, but I am confused about the payload in the profile.
I don't want the Login Window payload to lock the Computer Name field. Basically I only want the Login Window payload to change the Name and Password text fields. I know you can do this with a defualts command, but I think its more convenient with a profile.
What exact option locks the Computer Name text field? It was my understanding that when you have the "Set computer name to computer record name" UNTICKED in the payload, that it should not lock it down. Or is it some other options that locks it?
Posted on 09-06-2018 05:08 AM
That setting should lock/unlock the option to Computer Name in SysPrefs > Sharing. Do you have any other Config Profiles that are locking down users from changing the computer name and conflicting with this one?
The suggestion to run the scutil
command was to see if the JSS was renaming the machine to its record. If it was, then there might be another ConfigProf elsewhere conflicting.
Posted on 09-06-2018 05:12 AM
@Tangentism Alright thanks mate, will investigate!
Posted on 09-06-2018 07:53 AM
Where is the "Set computer name to computer record name" located? I wonder if we have it ticked.
Posted on 09-06-2018 01:49 PM
@pandrum We use the following script (GitHub) in a Self Service policy scoped only to our support team:
#!/bin/sh
####################################################################################################
#
# ABOUT
#
# Rename Computer
#
####################################################################################################
#
# HISTORY
#
# Version 1.0, 18-Jun-2015, Dan K. Snelson
# Original version
#
####################################################################################################
echo "*** Rename Computer ***"
### Log current computer name
currentComputerName=$( /usr/sbin/scutil --get ComputerName )
echo "Current Computer Name: $currentComputerName"
### Prompt for new computer name
newComputerName="$(/usr/bin/osascript -e 'Tell application "System Events" to display dialog "Enter the new computer name:" default answer "" buttons {"Rename","Cancel"} default button 2' -e 'text returned of result' 2>/dev/null)"
if [ $? -ne 0 ]; then
# The user pressed Cancel
echo "User clicked Cancel"
exit 1 # exit with an error status
elif [ -z "$newComputerName" ]; then
# The user left the computer name blank
echo "User left the computer name blank"
/usr/bin/osascript -e 'Tell application "System Events" to display alert "No computer name entered; cancelling." as critical'
exit 1 # exit with an error status
fi
### Set and log new computer name
/usr/sbin/scutil --set ComputerName "$newComputerName"
echo "New Computer Name: $newComputerName"
### Update the JSS
/usr/local/jamf/bin/jamf recon
# Inform user of computer renamed
/usr/local/jamf/bin/jamf displayMessage -message "Renamed computer from: "$currentComputerName" to "$newComputerName"" &
echo "Renamed computer from: "$currentComputerName" to "$newComputerName""
exit 0 ## Success
exit 1 ## Failure
Also, if you rename the computer in Jamf Pro, you'll need to use the Maintenance > Reset Computer Names option to have Jamf Pro trump the local computer name before its next inventory update.
Posted on 11-18-2021 10:24 PM
The script as written works, but it leaves the Bonjour name untouched, creating a mismatch. While the Bonjour name IS editable in System Preferences, we might as well change both while we're at it.
I would suggest adding this line:
/usr/sbin/scutil --set LocalHostName "$newComputerName"
Posted on 07-21-2021 11:29 AM
Did anyone ever figure this one out? I have no Login Window payload configured, but something is restricting the changing of the computer names.
Posted on 07-29-2021 08:40 AM
Just to update in case anyone comes across this. We had a profile being distributed that was including a configured login window payload. This payload was not actually configured in the UI from what we could tell. We ended up having to recreate the profile and redistribute to remove the payload.
There is a new update coming out that will help in these situations: Unknown Keys in Configuration Profile Payloads.