Post-install scripting, can't screenshare with my Macs after install... HELP!
#!/bin/bash serialNumber=`ioreg -l | grep IOPlatformSerialNumber | awk '{print $4}' | cut -d \" -f 2` computerName="$serialNumber" /usr/sbin/scutil --set LocalHostName "$computerName" /usr/sbin/scutil --set ComputerName "$computerName" /usr/sbin/scutil --set HostName "$computerName" sudo /usr/bin/defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist NetBIOSName "$computerName"
The intention for this script is to only have to touch the computer to start imaging. After deployment, I want the script to automatically name the Mac by it's serial number and be able to access it via Apple Remote Desktop using serialNumber.local for address. But ARD never sees the computer after reboot (image being deployed does have Remote Management enabled). The script does rename the computer correctly which I can verify by logging in on the Mac to check it's name. Also, when viewing the SystemConfiguration/preferences.plist, I see that the serial number is correctly set for each of the 3 names. After taking the unit off of the imaging rack and connecting it to wifi, the unit does become available in ARD, but I noticed that the DNS name is some other random name (ch-aract-ers.ourschoolsdomain.org). After poking around, I found that this was the NetBIOS name that was written in the /SystemConfiguration/com.apple.smb.server.plist file. So, this is when I added the line to the script that changes the NetBIOSName. Still, upon reboot after imaging, NetBIOSName is still some other name. Oddly, it will assign the serial number as the NetBIOS name when take it off the rack and switch to wifi. What I really need, though, is to not have to physically touch the Mac again after deployment. I need to be able to do all post-imaging from within ARD.
Please help!!!! I'm running out of time to figure this out!
Answers (0)
Be the first to answer this question
system_profiler SPHardwareDataType |awk '/Serial Number/ {print $4; }' - MacDude 10 years ago
http://support.apple.com/kb/HT2370?viewlocale=en_US&locale=en_US
the computer name may be a red herring - MacDude 10 years ago