/build/static/layout/Breadcrumb_cap_w.png

Rename Mac to serial post imaging

Has anyone got a way to rename a mac to it's serial number as a post imaging task? Any info is much appreciated!

Dennis

0 Comments   [ + ] Show comments

Answers (4)

Posted by: samislam 12 years ago
Senior Yellow Belt
2
try this shell script
=================
#!/bin/bash

HOSTNAME=`system_profiler | grep "r (system)" | awk '{ print $4}'`

/usr/sbin/scutil --set ComputerName "${HOSTNAME}"
/usr/sbin/scutil --set LocalHostName "${HOSTNAME}"

exit 0
==================

it works for me.
Posted by: scottlutz 12 years ago
Orange Senior Belt
0
I've never done it, but there is no reason why this shouldn't work, just run it as a post install bash script:

system_profiler | grep "Serial Number (system)" | sed 's/Serial Number (system): //' | xargs scutil --set HostName
Posted by: ddevore 12 years ago
Fourth Degree Green Belt
0
Thanks Scott! I did change the very end to computername and it looks like after a reboot the share and host names both match the serial.

system_profiler | grep "Serial Number (system)" | sed 's/Serial Number (system): //' | xargs scutil --set ComputerName

Dennis
Posted by: scottlutz 12 years ago
Orange Senior Belt
0
Sam, I was not quite happy with the original results ans did some digging around. If you want to speed your script up, try this small change:
from: HOSTNAME=`system_profiler | grep "r (system)" | awk '{ print $4}'`
to: HOSTNAME=`system_profiler SPHardwareDataType | grep "r (system)" | awk '{ print $4}'`

When I ran %time on each one, I saw about a 90% performance increase.

HTH
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ