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
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.
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
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.
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. :)
Issue was being caused by the version of the JSS and a known bug.
What version of JSS fixes this bug? 8.71 presumably?
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}
How is this marked as solved? I upgraded to 8.71 and I am still having the exact same issue
@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.