So, I have a post-install script that I sussed out from numerous web searches:
#!/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!

3 Comments   [ + ] Show Comments

Comments

  • Getting the serial number is faster with:

    system_profiler SPHardwareDataType |awk '/Serial Number/ {print $4; }'
  • Thank you! I do appreciate efficiency. Any thoughts on how to successfully access via Apple Remote Desktop after imaging?
  • Are you running kickstart to turn it on?

    http://support.apple.com/kb/HT2370?viewlocale=en_US&locale=en_US

    the computer name may be a red herring
Please log in to comment

There are no answers at this time

Answers

Answer this question or Comment on this question for clarity
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja

Share