Machine name based on serial number in OSD

2017-12-07T15:21:57+00:00 September 27th, 2013|Azure, Cloud, Windows|

There was a requirement at a customer site recently to base new build machine names on the serial number of the device.  It was also necessary to further distinguish between laptop and desktop platforms by using a “LT” or “WS” prefix before the serial number to fully identify the device. Using SCCM 2012 SP1 with MDT 2012 integration this was easily achieved using the MDT task sequence variables.

Within the SCCM task sequence, after the Gather step, the serialnumber, IsLaptop and IsDesktop variables are populated and available.  To set the computer name to its serial number simply requires adding a Set Task Sequence Variable step where:

  • Task Sequence Variable = OSDComputername
  • value = %serialnumber%

To distinguish between laptop and desktop requires two Set Task Sequence Variable steps; one to set

  • Task Sequence Variable = OSDComputername
  • value = LT-%serialnumber%

and the other to set:

  • Task Sequence Variable = OSDComputername
  • value = WS-%serialnumber%

An IF condition is then added to the LT-%serialnumber% step:

  • Task Sequence Variable IsLaptop equals “TRUE”

and an IF condition is then added to the WS-%serialnumber% step:

  • Task Sequence Variable IsLaptop equals “TRUE”

This sets the OSDComputername  based on whether the machine is a laptop or a desktop.

The customer was using the User Driven Installation wizard to set the computer name and Active Directory OU location as part of the task sequence.  The additional steps added to the task sequence allowed the new computer name to be pre-filled in the wizard.

Keep in mind that the machine name must be 15 characters or less so a script to check length and trim if over 15 characters would be recommended.

Regards