Posted on 05-08-2014 10:44 AM
How do you change the name of a computer in the JSS?
Signed,
Newbie
Posted on 05-08-2014 10:53 AM
Typically I would use ssh and scutil to accomplish this. You could make a policy with "reset computer names" checked off under "Advanced", change the name of the computer in the JSS under a machine's "Computer Information", then execute the policy. I find this to be a bit too roundabout when I have ssh to work with.
Reset the Computer Name:
sudo scutil --set ComputerName samplecomputername
Reset the Local Host Name: sudo scutil --set LocalHostName samplelocalhostname
Reset the Host Name (if applicable):
sudo scutil --set HostName samplehostname
You can also use scutil --get to check each value after you set them.
Then run a "jamf recon" command and you will see that the machine's name has updated in the JSS.
Posted on 05-08-2014 10:58 AM
Find the computer you want to rename the Inventory (General Information, hit the edit button, change the Computer Name and hit save).
You can then scope a policy to rename the client to reflect the entry in the JSS. Create a policy and go to "Maintenance" and check the box for "Reset Computer Names." Set the policy to run once per computer and on however many triggers you like.
Posted on 05-08-2014 11:11 AM
The problem with the above from Pearlin, is that if the machines in question check in during the time you wait to do the 2nd step it will overwrite what you just changed in the jss back to the original name thereby making this process a loop of madness.
This could be a great feature request though:
What should happen is when you change the name in the JSS it should send a command to the target computer immediately to reset the computer name to what is in the JSS. This keeps from creating too many steps.
Gabe Shackney
Princeton Public Schools
Posted on 05-08-2014 11:22 AM
Gabe's right. You sometimes get stuck in a stare down with machines that report an inventory before the policy runs and then have to start all over again. Not a big deal if it's just a handful (it's still annoying), but wouldn't be fun in the tens, hundreds, or thousands of computers.
As for that Feature Request: https://jamfnation.jamfsoftware.com/featureRequest.html?id=2190
Go vote it up!
Posted on 05-08-2014 11:45 AM
LOL I made a feature request as well. Hopefully they combine them...
Gabe Shackney
Princeton Public Schools
Posted on 05-08-2014 12:15 PM
I saw that, so I changed the link to point to yours. After all, it was your idea.
Posted on 05-28-2014 06:24 AM
I use the following when it comes up (assuming that my computer name is good).
#!/bin/sh
scutil --set LocalHostName $(scutil --get ComputerName)
scutil --set HostName $(scutil --get ComputerName)
exit 0
Of course, the real question has to do more with how you "want" to set your computer names. You do have to put something in somewhere.
Posted on 02-15-2017 04:39 PM
we used to have
$JAMF setComputerName --useSerialNumber
but Sierra does not like it.
shall we use
sudo scutil --set ComputerName --useSerialNumber
?
Posted on 02-22-2017 11:37 AM
What I do is post a Policy in Self Service that is on all computers but limited to my Techs LDAP grouping. This policy contains a custom script that asks the Tech to input the new computer name, Sets it correctly on the computer, then I have it run inventory. This works really well as not all my techs have visibility into our JAMF Pro. Here is the script:
COMPUTERNAME=$(/usr/bin/osascript << EOT
tell application "Finder"
activate
display dialog "Enter the Computer Name, please." default answer ""
set COMPUTERNAME to the (text returned of the result)
end tell
EOT)
/usr/sbin/scutil --set ComputerName $COMPUTERNAME
/usr/sbin/scutil --set LocalHostName $COMPUTERNAME
/usr/sbin/scutil --set HostName $COMPUTERNAME
dscacheutil -flushcache
exit 0
Posted on 11-01-2018 11:13 AM
Since i like using the serial number i do this
set the trigger to before then create an AD Bind trigger and set that to set after
definedComputerName="/usr/sbin/system_profiler SPHardwareDataType | awk '/Serial Number/ { print $NF }' | rev | cut -c 1-8 | rev
"
/usr/sbin/scutil --set ComputerName ${definedComputerName}
/usr/sbin/scutil --set LocalHostName ${definedComputerName}
/usr/sbin/scutil --set HostName ${definedComputerName}
exit 0