How do you change the name of a computer in the JSS?
Signed,
Newbie
10 replies
A
Anonymous
May 8, 2014
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.
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.
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'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.
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:
!/bin/bash
Created by FeasiblePear
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)
Set Computer, LocalHost, and HostName from Tech's input