KACE Product Support Question

New administrator (K2000): Mac imaging (pre/post installation tasks help request)

07/20/2015 2700 views
I've gone through the information available here:

Great start, got the image built.  Now having difficulties with understanding the pre/post installation tasks.  I come from a PC administrative setting with a user perspective for Macs, so still trying to understand the Mac side scripting.  I've had some success with a manually run script after installing the OS image, but would like to automate the process in order to streamline it for the techs with less familiarity with Macs.  The default script references a file that associates computer names with their mac addresses, but I am uncertain as to the location of this file referenced:


MAC=`/usr/sbin/networksetup -getmacaddress Ethernet 2> /dev/null | awk ' { print $3; }' | sed -e s/://g `


volume=`mount | grep -m 1 disk0`
zeroMount=`echo "$volume" | awk  '{  print substr($0,index($0, "on ")+3,index($0, "(")-index($0, "on ")-4) }'`


tComputerName=`/usr/libexec/PlistBuddy -c "Print System:System:ComputerName" $prefPath` 
computerName=`echo $tComputerName | awk '{ print index($0,"Not Exist") }'`
if [ x$computerName == x0 ]; then

echo $computerName > "${TEMP_PATH}"

exit 0

3 Comments   [ + ] Show comments


  • Apparently I've misunderstood the script description and information. The script supposedly above caches the -existing- computer name and restores it after the imaging process is completed. It does not pull computer names from a previously existing file on the KACE appliance.
  • I have switched gears and am trying to work with my own post-installation script. The problem is that the post-installation scripts do not appear to trigger, so the computer renaming (or any other tasks) does not occur. I am using the following script as a Mac OSX Post-installation Task Detail:


    # Set variables
    echo Enter new computer name:
    echo Enter new domain name:

    # Change hostname
    echo Configuring hostname...
    hostname $NEWHOSTNAME
    scutil --set HostName $NEWHOSTNAME
    echo Done configuring hostname
    echo Configuring local hostname
    scutil --set LocalHostName $NEWHOSTNAME
    echo Done configuring local hostname
    # Change computername (Bonjour and AppleTalk name)
    echo Configuring computername...
    #systemsetup -setcomputername $NEWCOMPUTERNAME
    scutil --set ComputerName $NEWHOSTNAME
    echo Done configuring computername
  • After a bit more testing, it appears that you cannot (properly) run scripts that require user input while the script is running.
    Is there a way to run a script that opens the console window and waits for user input? I would prefer to avoid leaving an AD admin account and password in a text file just to add the imaged computers to the domain.

Be the first to answer this question

Don't be a Stranger!

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

Sign up! or login


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