/bundles/itninjaweb/img/Breadcrumb_cap_w.png
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   [ - ] Hide Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity

Answers

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
Answered 02/28/2012 by: scottlutz
Orange Senior Belt

Please log in to comment
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
Answered 02/28/2012 by: ddevore
Fourth Degree Green Belt

Please log in to comment
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.
Answered 02/29/2012 by: samislam
Senior Yellow Belt

Please log in to comment
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
Answered 03/05/2012 by: scottlutz
Orange Senior Belt

Please log in to comment