Continuing with the concept of automated server deployment, here is a small script that changes the serial number in a Mac OS X Sever installation.
A server system that has been deployed via disk imaging or automated deployment systems will boot, but to use the server features, a valid and unique serial number must be entered. Luckily, Apple provides a command line utility to set the serial number.
The script, as written, is intended for use with The Casper Suite. Replacing $4 with a static value or using another method of passing a value would be necessary if you are not using The Casper Suite.
#!/bin/bash ##### HEADER BEGINS ##### # scr_sys_setServerSerial.bash # # Created 20081231 by Miles A. Leacy IV # miles.leacy@themacadmin.com # Modified 20081231 by Miles A. Leacy IV # Copyright 2008 Miles A. Leacy IV # # This script may be copied and distributed freely as long as this header
# remains intact.
# # This script is provided "as is". The author offers no warranty or
# guarantee of any kind. # Use of this script is at your own risk. The author takes no responsibility
# for loss of use, # loss of data, loss of job, loss of socks, the onset of armageddon, or any
# other negative effects. # # Test thoroughly in a lab environment before use on production systems. # When you think it's ok, test again. When you're certain it's ok, test
# twice more. # # This script sets a Mac OS X Server installation's serial number to the value # provided in $4 by Casper. # Run as an "at reboot" script when imaging with Casper, making sure to type # double-check the serial in the script parameters before imaging. # ##### HEADER ENDS ##### # Change serial to $4 from JSS /System/Library/ServerSetup/serversetup -setServerSerialNumber "$4"
#!/bin/bash
##### HEADER BEGINS #####
# scr_sys_setServerSerial.bash
#
# Created 20081231 by Miles A. Leacy IV
# miles.leacy@themacadmin.com
# Modified 20081231 by Miles A. Leacy IV
# Copyright 2008 Miles A. Leacy IV
#
# This script may be copied and distributed freely as long as this header remains intact.
#
# This script is provided “as is”. The author offers no warranty or guarantee of any kind.
# Use of this script is at your own risk. The author takes no responsibility for loss of use,
# loss of data, loss of job, loss of socks, the onset of armageddon, or any other negative effects.
#
# Test thoroughly in a lab environment before use on production systems.
# When you think it’s ok, test again. When you’re certain it’s ok, test twice more.
#
# This script sets a Mac OS X Server installation’s serial number to the value
# provided in $4 by Casper.
# Run as an “at reboot” script when imaging with Casper, making sure to type
# double-check the serial in the script parameters before imaging.
#
##### HEADER ENDS #####
# Change serial to $4 from JSS
/System/Library/ServerSetup/serversetup -setServerSerialNumber “$4″







