Posted on 01-04-2012 01:56 PM
Is there a way to force the Computer Name using a reference list like a CSV?
We have a good number of Mac users who are grandfathered in with admin rights. That's not likely to change.
We're hoping to come up with a way to revert the Computer Name whenever a user changes it. Hoping after a few tries the user stops trying.
Possible with Casper?
Don
Posted on 01-04-2012 03:22 PM
I have achieved static computer names with the following:
Computer records created in OD for each computer
MCX to set computer name to computer record name
MCX to prevent changes to the sharing system preference pane
Can look up the MCX keys if you need them.
Posted on 01-05-2012 09:09 AM
@lisacherie please share. :-)
Posted on 01-05-2012 10:26 AM
@lisacherie +1 for sharing, please!
I am currently linking OD computer records to static groups in JSS with LDAP "server connection" - used for Computer Lists
but some of the hardware is not being shown in JSS (mainly newer models)
MAC address is not 100% reliable here...
Thank you!
Carlo
Posted on 01-05-2012 01:55 PM
We are preventing changes to the computer name by using MCX. We are still on Open Directory MCX as we are very dependent on MCX and migrating all of the keys to Casper MCX is a big job that is still on my todo list.
This assumes the computer is bound to OD, you might also be able to achieve this by extending the AD schema - but not something I have tried.
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.
Posted on 01-05-2012 09:48 PM
Because adding lots of computers to OD is a pain (we are over 1500), here is a script you can use to bulk import from a spreadsheet.
#!/usr/bin/env ruby
odAdmin="your directory admin shortname" #enter your OD admin name between the quotes
odPassword="the password" # Enter your OD admin password between the quotes
domain="odserver.yourdomain.com" # FQDN of your OD domain
filename = "your csv file.csv"
file = File.new(filename, 'r')
# column numbering begins at 0, [ indicates end of row in the csv file
file.each_line("[") do |row|
columns = row.split(",")
computer_long_name = columns[2]
computer_short_name = columns[3]
mac_address = columns[1]
puts "#{computer_long_name}, #{computer_short_name}, #{mac_address}, #{computer_list}
"
# Add computer to to OD
puts "The comand to add the computer would be (commented out command directly below):
"
puts "dscl -u #{odAdmin} -P #{odPassword} /LDAPv3/#{domain} -create /Computers/#{computer_short_name} ENetAddress #{mac_address}
"
`dscl -u #{odAdmin} -P #{odPassword} /LDAPv3/#{domain} -create /Computers/#{computer_short_name} ENetAddress #{mac_address}`
# Set the real name of the computer
puts "
The comand to set the real name would be (commented out command directly below):
"
puts "dscl -u #{odAdmin} -P #{odPassword} /LDAPv3/#{domain} -merge /Computers/#{computer_short_name} RealName "#{computer_long_name}"
"
`dscl -u #{odAdmin} -P #{odPassword} /LDAPv3/#{domain} -merge /Computers/#{computer_short_name} RealName "#{computer_long_name}"`
end
Posted on 01-06-2012 08:05 AM
This solution only works if you are using Open Directory though, correct?
Posted on 01-06-2012 06:41 PM
The MCX to set the host name is in MCX template provided in the JSS so I'm hoping it still works with Casper MCX assuming the computer record is defined in the directory - Something to test...
I also hope that if AD was extended for the computer records the MCX from the JSS would work too.