*SOLVED***** Computer Name Reverts... My Kingdom for a Solution.

saulv
New Contributor III

Dear Jamf Friends:

I have asked this before, but I now have a few more bits of information.

The Problem: Student Laptop Computer Names continue to revert to names that are not in the JSS.

Set computer name to computer record name is checked in the Log In Window Config. It works. Temporarily. But at check-in Jamf goes out retrieve that old name from God Knows where and reapplies it.

I was last led to check the DNS and DHCP, but after multiple cache flushing and rabbit holes, I’m convinced it has nothing to do with our DNS. (But could still be swayed)

I have used Jamf Remote to rename. No luck (To be clear, no luck means the action of renaming worked, but that it eventually reverts back to the old name from before we even had Jamf.)

I have used Scutil in Terminal to configure the Computer Name, Host Name and Local Host Name Followed by Recon. Nope.

I have deleted the sysconfig .plist that contains the Computer Name, but it will eventually repopulate and contain the old name.

The HOSTNAME and LOCAL HOSTNAME will stay correct, but the Computer Name shown in the Sharing Pane of System Prefs will always revert back.

It’s maddening. It matters because Jamf uses that to inventory and if it’s wrong it screws up my Smart Groups/Scoping etc.

These machines were wiped down to the bare drive prior to enrollment, but is there some place on the recovery drive that stores the Computer Name the first time it is named?

Could it live inside a Cert or other Keychain item?

Is it inside the MDM Profile?

Where on God’s Green Earth is Jamf going to fetch that old name?

If I unenroll the machine, it won’t happen, but under Jamf Management each check-in causes the name to revert.

I’m sending this to Jamf as well, but there are so many smart folks on this board, I thought I’d try one more time before I quit my job and join the Merchant Marines.

Thanks for any attempts at a solution!

5b28f826fc5042ccb40999e5bf7893f7

15 REPLIES 15

mcrispin
Contributor II

There are many ways to solve this, what I normally do:

Let's say I want to force the serial as the computer name:

#!/bin/sh
#

sn=$(system_profiler SPHardwareDataType | awk '/Serial/ {print $4}')

scutil --set ComputerName "$sn"
scutil --set HostName "$sn"
scutil --set LocalHostName "$sn"

/usr/local/bin/jamf setComputerName -name "$sn"

/usr/local/bin/jamf recon

exit 0

(that last recon is very much needed)

Then on your regular recon task, make sure to tick the box that says enforce "Enforce Computer Names", if you want a user-input version of this script, there are many examples elsewhere on this site.

saulv
New Contributor III

I appreciate your info, but I'm not asking how to change the name. I'm an expert at that. I have a policy in place, and I as I said in my original post, I have manually done it through terminal at least 7837839 times. And, yes, I even ran your script just as a good faith effort. I see the name change and all is good, but as soon as the machine reboots the computer name will be back to the old name. I'm so discouraged.

derek_ritchison
Contributor

This is interesting. I see this every once in a while as well, and have not found a solution. But what I see way more often is the Building field under User and Location reverting to blank.

mm2270
Legendary Contributor III

Are you taking an inventory collection right after the name is changed? You might have mentioned this and if I missed it I apologize. I just want to be sure, because the setting you have in your policy to rename computers will use whatever the Jamf server has as it's current name in the console. If you are renaming these machines, performing a recon/inventory collection and confirming that the correct name is now showing up for that computer record, and it's still reverting back to an old name, then something very very strange is going on. Might want to open a support case with Jamf on this if that's the case, 'cause that makes no sense at all. That is not how it's supposed to work.
I can see DNS coming into play here, but I don't believe it would really be completely renaming the Mac's primary computer name. DNS host name sure, I can see that. But that isn't what gets reflected in the Computer name field in a record.

jhuls
Contributor III

@saulv I won't proclaim to be an expert here but have you looked at or had someone else look at your DHCP configuration on the DHCP server? I could be mistaken but I believe DHCP has the ability to configure host names.

On a different note I have no idea how I ended up following this discussion. I just got an email for it but I'm quite sure I hadn't marked it as one to follow. Oh well...lol.

wmehilos
Contributor
It’s maddening. It matters because Jamf uses that to inventory and if it’s wrong it screws up my Smart Groups/Scoping etc.

This is why I moved away from basing Smart Groups off of the computer name and use something relatively immutable like Serial Number, or even better, PreStage. I have some scripts that kick off on each Mac either at enrollment or at login/logout once a week that rename them to what I want, and recon a few times (I find it takes more than one sometimes for the record in Inventory to reflect the new name), but ultimately I couldn't care less if I have a Smart Group full of "So and so's Macbook Pro"s or "iMac"s, it only really is there so I can easily search for stuff, it's not going to blow my scoping up.

I realize this doesn't exactly help your predicament, I only offer it up as a "do you really need to solve this problem, or just change how things are done" solution. It does sound like something to reach out to Jamf about. Like I said, I sometimes have to force recon to run twice in order for Inventory to reflect the change, but I've never had anything revert back. I don't run any Maintenance payload Policies with the Reset Computer Names checkbox checked, no "computer name to computer record name". Jamf just runs the Policies to make the name changes and recon a few times, outside of that it has no control over the naming. What happens if you uncheck the "computer name to computer record name" box in the Login Window config, and leave everything else the same?

jhuls
Contributor III

One other thing I'll throw out there is can you rebuild one of the problem Macs and not enroll it? Does the name change? If it does not, then enroll it manually? Does the name change now?

wlcasey
New Contributor III

Are your Macs bound to AD? Unless your in a custom environment DNS and DHCP are both live to service AD. If you are bound to AD, unbind then rename, then bind with new name, then JAMF recon.

saulv
New Contributor III

wlcasey.... well, we may have had a breakthrough. (through tedious steps of peeling off config after config and policy after policy) I did try the unbind/rebind and it is for sure part of the problem. However it's not AD, it's just OD on an old Apple Server that authenticates student log-ins. I still cannot get the name to permanently stick even using your above mentioned steps. Even after Recon, as soon as I reapply the Binding Config it reverts back to the old name. I see nowhere in the Apple Server where any of that info would be kept. It is literally just a list of usernames and passwords, no Computer info as far as I can tell. Anything I should look at inside of Apple Server? Getting closer! Thanks everyone.

saulv
New Contributor III

Hello All! OK... So it is definitely linked to my OD Binding. I can remove the binding, change the computer name and it will stay. As soon as I re-bind, either through Jamf Config Profile, or manually via terminal, the Computer Name Reverts.

Again, our OD Server is running Apple Server 5.2.

All we do is authenticate student username and password.

Is there a cache of files somewhere on that server that would be the source of the old computer name? The computer name is no where in the Apple Server Open Directory GUI, but maybe lives somewhere deep.

Any guidance or direction is greatly appreciated.

saulv
New Contributor III

*SOLVED*

I ended up solving this myself. Jamf Support and Jamf Nation tried, but it was my own sleuthing that ended up fixing the issue. It's sort of surprising that old-time Mac Server folks didn't immediately point me in the right direction.

It was in an old supplemental Apple Server program called Directory Manager(BTW this program is not built into the Apple Server GUI so I had no clue of it's existence). Way before I ever worked here, they used it to manage computer groups etc. Those old computer names were linked to a unique hardware ID that the LDAP would pull from to repopulate the Computer Name on the client machines. Months this has been driving me bonkers. Feels good to resolve it. Now onto the next headache which I'm sure is just around the corner.

jhuls
Contributor III

@saulv Glad you figured it out. Much of the time unique problems tend to be unique to the environment so this fits with why you were having trouble getting answers from others. I've never worked with what you're describing and I'd wonder how many others here have as well. Unfortunately you lost time out of it but now you can move forward with a better idea of how things are configured and everything works more as expected.

atlantamacguru
New Contributor II

@saulv So, what did you do to resolve this? Did you edit the records in Directory Manager for each machine? Or did you change something in Jamf to stop the enforcement of the Computer Name LDAP records upon check-in?

hdharam
New Contributor

@saulv How did you go about resolving the issue with the name reverting back?

saulv
New Contributor III

I deleted those records out of Directory Manager and never had the issue again!