Computer Naming

Not applicable

Happy Monday All,

I am having an issue where from time to time students and teachers decide it is a good idea to just power down the computer by holding the power button until the machine turns off. Once the computer restarts, it is changing the machine name by adding (N) where N=the number of times it has a hard reboot.

This is not critical, but it is annoying to me and makes my ARD and JSS look sloppy.

Is there a way in Casper to set up a policy that auto renames the computers back to what they were?

Thanks in advance.

-- "The most likely way for the world to be destroyed, most experts agree, is by accident. That's where we come in; we're computer professionals. We cause accidents." ~Nathaniel Borenstein -- Lance L. Lennon
District Technology Director
Eagle Grove Community School District
515-448-4749

16 REPLIES 16

bentoms
Release Candidate Programs Tester

I've had users require web sharing to host website on mamp.

But that's about it.

Regards,

Ben.

ScottSecrest
New Contributor III
New Contributor III

In my case, mdnsresponder reported the specific ip address of another Mac on the network that initiated the rename. The other Mac had 2 bonjour instances of the original Mac listed in finder. It also had ARD's admin console installed. I was unable to successfully rename the computer until I shutdown the other Mac. This was back when I was a sys admin at Nat Geo. I suspect it is somehow related to DNS and/or DHCP.

Scott

--
Scott Secrest
Systems Engineer
JAMF Software
(703) 462-0223

On Oct 3, 2011, at 2:49 PM, Thomas Larkin wrote:

Yup I am pretty sure it has to do with DHCP (the device giving it out) keeping record of the host and if it reconnects from a sleep or different interface it may request a new IP (depending on your lease times) and the old IP is still under that host name so it dupes itself.

Turning off Bonjour discovery may fix it, after all it is Bonjour that is appending the computer name I believe.

Not applicable

I know that in Casper Remote if you run the "Reset Computer Names" option it should set them to what's in the JSS. You should be able to push that out as a policy under the "Advanced" Settings.

ernstcs
Contributor III

Gee...you know, Lance, this certainly would be a really nice thing to have
in the JSS and I'm sure others have asked as well. Not sure why it's not
already in the JSS as to me this seems like a really easy option to add
in. A simple checkbox in inventory preferences that says fix computer name
of system at recon to always use the JSS' computer name.

The reason this is important using the JSS name is that the very first
time you image a machine you should name it how you want it, and that
should never really change unless you totally redeploy a box. The fix
option mentioned in Casper Remote takes the name that's in the JSS and
uses that. The problem here is that if the box with the wrong name, has
the (X) in it, already did an inventory check it updated the JSS name to
be wrong, too. So it doesn't fix it unless you go in and manually edit the
details of the system in the JSS first THEN go and do a fix name in Remote.

I'll send you a little more detailed on how we get around this at UWEC
when I have a little more time. Later. I'm sure Tom Larkin will chime in
here, we both do it similarly.

Craig E

tlarkin
Honored Contributor

I wrote a set of naming convention scripts that set the name to a local file and then creates a policy to check that local file and change the name accordingly.

http://www.casperadmins.com/index.php?threads/prevent-users-from-changing-computer-name.31/

Matt reposted on his site

sean
Valued Contributor

Lance,

It's all very well having a script to correct the incorrect name, but it wont get rid of the actual cause. The name will only increment if there is a machine (or your system believes there is a machine) already with the same name. It's afp ensuring that each name is unique.

So, rather than fighting a continual battle between script and the OS, I really would route out why it is happening.

Sean

ernstcs
Contributor III

If you figure it out let me know...because there are no duplicate names on
our network, and nothing thus far has stood out as a cause. Someday I'll
spend some more quality time with our network admin perhaps.

This is still valid if you want to stop people who have admin from naming
their box to something else.

Craig E

lance_ogletree
Contributor

Resetting the computer names can be performed via a policy.

Locate your Update Inventory policy which is triggered to execute once per day.
Click on the Advanced option within the policy.
Check off "Reset Computer Names"

When the policy kicks off to run the inventory update, there should be a check on the computer name first. If's there's a mismatch, the computer name as listed in the JSS will be applied to the computer prior to the inventory
running.

If you've already seen an inventory run, and the wrong computer name has been sent to the JSS and updated, you'll need to manually remediate within the JSS or explore our developer SDK( Take a look at the Coco code example ).

Long term users may want to consider denying access to the Sharing Preference Pane in Systems Preferences which can be managed via Managed Preferences(MCX).

Hope this helps.

-Lance

--
Lance Ogletree
Systems Engineer - South
Mobile: (972) 342-5990
Direct: (972) 547-9566
lance.ogletree at jamfsoftware.com<mailto:lance.ogletree at jamfsoftware.com>
lanceo at mac.com<mailto:lanceo at mac.com>(iChat)
Register now for the JAMF National User Conference<http://www.jamfsoftware.com/events/user-conferences/national-user-conference-2011/>

....................................................................
JAMF Software
1011 Washington Ave. S
Suite 350
Minneapolis, MN 55415
....................................................................
Office: (612) 605-6625
Facsimile: (612) 332-9054
....................................................................
US Support: (612) 216-1296
....................................................................
http://www.jamfsoftware.com<http://www.jamfsoftware.com/>

tlarkin
Honored Contributor

This has to do with Bonjour and mdnsresponder. Basically if a computer searches it's local subnet and finds a computer with the same name, it appends the name with a number. Now, there have been bugs with local dns searching that Bonjour uses and the machine finds itself on the network but sees itself as a dupe, so it adds the number.

Try using the scutil to set the computer name and localhost name. Flush out any dns caches or force a release renew on your DHCP and see if that does anything.

-Tom

stevewood
Honored Contributor II
Honored Contributor II

I have a hunch about what causes this, but I haven't had the time, nor the
On Mon, Oct 3, 2011 at 12:20 PM, Ernst, Craig S. <ERNSTCS at uwec.edu> wrote:
means, to do the detective work to prove it. I believe, at least in my
environment, what happens is that the machines are seeing a second interface
as a separate computer. For example, a machine that is connected via
ethernet and wireless at the same time, for some reason causes the machine
to see two machines on the network at the same time. I can't prove it, I'm
not even certain if it is possible, but that's the hunch I have.

Can anyone verify that, or does this even sound possible?

Steve Wood
Director of IT
swood at integer.com

The Integer Group | 1999 Bryan St. | Ste. 1700 | Dallas, TX 75201
T 214.758.6813 | F 214.758.6901 | C 940.312.2475

tlarkin
Honored Contributor

The problem with this method though Lance is that if the machine Recon'd after the name change then the JSS has the wrong name. Which is why I cache a file locally to store the computer.

-Tom

rockpapergoat
Contributor III

that's been the case whenever i've seen it. if the dhcp lease for a given hostname is taken, and the client pops off the network, then back on (possibly via a different interface), the machine will assign a unique computer name to avoid the issue.

using the jss's feature of matching up hostnames will only work on machines if they haven't changed their hostnames automatically after a encountering a duplicate name on the network. chicken and egg.

if your machines are bound to OD, you can choose to use the policy that enforces hostnames to remain the same as their OD records. that's by far the easiest option, though not an option if you're using AD or otherwise.

ernstcs
Contributor III

This is also what I do with a startup item installed during imaging creates a file read by my inventory police scripts that first check the local machine name against the file, if it doesn't match it resets it to what the file has THEN it runs a recon.

Will be looking at the MCX though as we look at enabling that. I can't think of other reasons our users would typically need other options in the pane, but you know…

Thanks,

Craig E

tlarkin
Honored Contributor

Yup I am pretty sure it has to do with DHCP (the device giving it out) keeping record of the host and if it reconnects from a sleep or different interface it may request a new IP (depending on your lease times) and the old IP is still under that host name so it dupes itself.

Turning off Bonjour discovery may fix it, after all it is Bonjour that is appending the computer name I believe.

lisacherie
Contributor II

Hello,

We are preventing students from changing the computer name by using MCX. We are still on Open Directory MCX so not sure how this will go with Casper MCX.

1: Restrict access to the sharing pane in system preferences
2: Force computer name to use OD computer record name

Part 1:
com.apple.systempreferences
-> EnabledPreferencesPanes-Raw array
// contains string objects for each preference that is allowed eg.
name 0 type string value com.apple.preference.displays
name 1 type string value com.apple.preference.sound
etc....

Part 2:
com.apple.loginwindow
name UseComputerNameForComputerRecordName type boolean value true

Hope this helps.

Lisa.

Lisa Davies
ICT Client Services Manager
Saint Ignatius' College, Riverview
Phone: 02 9882 8413
Mobile: 0417 005 735

sean
Valued Contributor

I was under the impression that after an initial broadcast, a single machine will use it's own cache instead of continually broadcasting. A reboot should clear the cache, right? However, using the power button will prevent a machine from sending out a 'goodbye' and as such all other machines will think it still exists. On a re-power it should recreate it's cache with a fresh broadcast.

Surely, on a first broadcast it doesn't include itself in the search......surely!

So hitting the power button to turn off a machine shouldn't be any different to rebooting. Cache is cleared and a new broadcast and cache created on the machine coming back up.

The only difference between these two events is the lack of a 'goodbye' to all of the other machines on the network when using the power button.

I was also under the impression that flushing dns cache shouldn't affect the bonjour cache in anyway. Anyhow, the only way I can see that the duplicate names could be created in this particular event, is if a machine gets a response from other machines cache, rather than every other machines actual broadcasts.

So consider a 2 machine setup. mac1 and mac2. If mac1 were to be shutdown correctly, then mac2 will remove the cached record of mac1. However, if mac1 was shutdown abruptly by removing power, then mac2 would still think mac1 exists.

On re-powering mac1, would mac2 reply to a broadcast saying I exist, oh and I also know that there is a mac1 out there too?

If this is the case, then all the machines on the network would need their caches cleared after a single machine were shutdown abruptly. I find this hard to believe, as I don't have loads of machines with names like mac1 (2) and, like anywhere, sometimes users here use the power button.

So I quickly just tested this. I've turned off a few times, using the power button, a mac and not once has it thought about renaming itself when it has come back up!

Lance is suggesting that this is happening each time this is done, so something is awry somewhere. I wondering, when you reboot the machine Lance, do you have the same or different ip after the reboot?

Sean