Managed OS X 10.8.x grabbing DNS name instead of name set in Casper Imaging

vadanx
Contributor

OS: 10.8.2 and 10.8.3
JSS: 8.62
DNS: 2003 Active Directory

I am having an issue that is only apparent with managed Mountain Lion clients. When you image a Mac through Casper Imaging using a managed build, the Mac will automatically grab whatever name a reverse lookup can find in DNS and overwrite the name of the Mac and eventually update that name in the JSS, more often than not this name is not correct at all due to stale records in DNS.

When you image a Mac with a completely custom build in Casper Imaging (not managed via the JSS) then it keeps the name set in the application and does not lose it to the name in DNS.

I assumed it was a built-in issue with ML but since testing the non-managed build and it working, I have turned to you guys for help... I do not "reset" computer names in any policy in the JSS and cannot see where this must be coming from.

Andrew

Edit:

I do use a hostname script to set the name for HostName, LocalHostname and ComputerName, the issue still occurs with or without this script in place.

1 ACCEPTED SOLUTION

vadanx
Contributor

Issue was being caused by the version of the JSS and a known bug.

View solution in original post

10 REPLIES 10

Nix4Life
Valued Contributor

in your script do you point it to a preferred DNS server. I started in the Snow Leopard days due to the same issue

sudo dsconfigad -show | grep -i preferred

LS

jhbush
Valued Contributor II
scutil --set HostName $(scutil --get LocalHostName)

I use this in my First Boot script to lock the name down. It's worked well in conjunction with a script I use to reset the name if the end user changes it.

vadanx
Contributor

LSinNY

I don't set a preferred AD server, I allow the Macs to figure out via DNS which one to use.

jhbush1973

I use the same commands to set mine as well, still having the issue.

Thanks all the same.

Andrew

jhbush
Valued Contributor II

You may have to limit the DynamicDNS to a few interfaces. I use en0 and en1. Prior to that our machine were registering all sorts of names in DNS.

dsconfigad -restrictDDNS "en1,en0"

run as a policy once a day.

donmontalvo
Esteemed Contributor III

I doubt that HostName matters to JSS, only ComputerName should matter (LocalHostName should feed off ComputerName automagically).

The only other name that matters is the Computer ID which is the name your computer had when it was bound to AD. If you change ComputerName without changing Computer ID (unbind/rebind), the CMDB folks would probably yell at you about it. :)

--
https://donmontalvo.com

vadanx
Contributor

Issue was being caused by the version of the JSS and a known bug.

b_mike
New Contributor III

What version of JSS fixes this bug? 8.71 presumably?

clrlmiller
New Contributor III

I've been using a script posted by Oxford Univ to resolve this issue. JAMF has kept reporting the issue as resolved with each update but it keeps cropping up. We're still using 8.64 so we'll test again after updating to 8.71. But here is the script in case you find the issue still exists in 8.71. Set to 'After Reboot' in the system configuration.

####################
## Script Begins Below ##
####################
MacModel=$( ioreg -l | awk '/product-name/ { split($0, line, """); printf("%s ", line[4]); }' )
PrefModel=$( defaults read /Library/Preferences/SystemConfiguration/preferences.plist Model )

# Fix the incorrect model name in /Library/Preferences/SystemConfiguration/preferences.plist
# Also make sure the .plist is in the correct format

if [[ "$PrefModel" != "$MacModel" ]];
then /bin/echo $AdminPW | sudo -S defaults write /Library/Preferences/SystemConfiguration/preferences.plist Model $MacModel /bin/echo $AdminPW | sudo -S plutil -convert xml1 /Library/Preferences/SystemConfiguration/preferences.plist
fi

# Fix the incorrect network service names
# Script lovingly stolen from https://jamfnation.jamfsoftware.com/discussion.html?id=3422

# Detect new network hardware
networksetup -detectnewhardware

# List all network services and read one by one
networksetup -listallnetworkservices | tail -n +2 | while read service
do

# Remove asterisk from string for renaming disabled services
service=${service#**}

# Use filter to select next line which has the hardware port defined
filter=false

# Display network services
networksetup -listnetworkserviceorder | while read serviceorder
do
if [[ ${filter} == true ]]
then
# Grab hardware port
hardwareport=echo ${serviceorder} | sed -e 's/(Hardware Port: //;s/, Device:.*//'
# Check if service name if different
if [[ ${service} != ${hardwareport} ]]
then
# Rename the network service
networksetup -renamenetworkservice "${service}" "${hardwareport}"
echo -e "Renamed network service "${service}" to "${hardwareport}""
fi
fi

if [[ ${serviceorder} == *${service} ]]
then

# Got the line with the service. Set the filter to true to grab the next line which contains the hardware port
filter=true
else
filter=false
fi
done
done

# JAMF imaging should have set the machine name correctly. Let's make sure hostname is also set properly

setName=networksetup -getcomputername
scutil --set ComputerName ${setName}
scutil --set LocalHostName ${setName}
scutil --set HostName ${setName}

axnessj
New Contributor

How is this marked as solved? I upgraded to 8.71 and I am still having the exact same issue

vadanx
Contributor

@axnessj

No you're right, it appeared like this issue was resolved for us at least for a couple of weeks and then we started seeing it again. NOT RESOLVED.