How to Add a Mac’s Serial Number to the Set Hostname Task Sequence Step

2 users found this article helpful

The Set Hostname task sequence step allows you to assign a hostname to a Mac computer. Suppose we want a hostname to contain a Mac’s serial number (e.g. AcmeCorp_C05D78UJKO). This would make it easy to assign a unique hostname to a Mac without requiring user input.

Adding serial number to a hostname in the Set Hostname step

  1. Create SCCM software package, but do NOT specify any source files for it:

    alttext
  2. Specify the following command line for the package:
"$PMM_TS_VARIABLE_UTIL" --set OSDSerialNumber="$(system_profiler SPHardwareDataType | grep 'Serial Number (system)' | awk '{print $NF}')"

This command retrieves the Mac’s serial number from the system_profiler and assigns it to the OSDSerialNumber task sequence variable. It does this by using the command line utility, which can be accessed via the path contained in the PMM_TS_VARIABLE_UTIL environment variable.

  1. Set the Program can run property to Whether or not a user is logged on.

    alttext

    NOTE:

    Do NOT deploy this package to any collection.

    Do NOT distribute contents of this package to Distribution Points (it doesn’t contain any source files, so it’s not needed).

  2. When creating or modifying a task sequence, add the Install Software step after the Apply OS X Image step. Specify the software package that you created in the previous steps of this article.

  3. Add the Set Hostname step after the Install Software step. In the Hostname field, type “Mac-%OSDSerialNumber%” (without quotes).

If anything goes wrong during the task sequence execution, you can troubleshoot the problem using the following log:                                                                                          

/Library/Logs/pmm_launchd_helper.log

This log contains information about installing software packages, setting hostname, joining domain, and installing the Parallels Mac Client package.

The following screenshot is a sample of the pmm_launchd_helper.log file. The highlighted section contains the information about obtaining the Mac’s serial number.

alttext

Was this article helpful?

Tell us how we can improve it.