03 December 2012

Multiple Naming Schemas in the customsettings.ini file

It is nothing new that you can setup MDT or SCCM to automatically create the computer name via the customsettings.ini file. This is a sample I used from a forum on the net:

[ByLaptopType]
Subsection=Laptop-%IsLaptop%

[ByDesktopType]
Subsection=Desktop-%IsDesktop%

[Laptop-True]
OSDComputerName=LT%SerialNumber%

[Desktop-True]
OSDComputerName=DT%SerialNumber%

The problem comes when you also have a SQL database that custom names the computers too. In the scenario I work in, we normally name our computers DT%SERIAL% or LT%SERIAL%. There are exceptions such as our shared and training systems that have unique names I defined in the SQL database. The OSDComputerName variable is first come, first serve. The first thing to put a value in it will be the only value it will accept. Therefore, you will need to rearrange the setup of the Priority field. For my scenario, I re-sequenced the Priority field to first query the SQL server and then do the ByLatopType and ByDesktopType. If it is one of our unique systems being imaged, the value in the SQL database gets assigned first and then the standard name is read in the ByLatopType and ByDesktopType, but can't be written over the SQL injected value. 

This was the original setup of the Priority field:
Priority=ByLaptopType, ByDesktopType, CSettings, CPackages, CApps, CAdmins, CRoles, Default

This is the rearranged setup that works perfectly:
Priority=CSettings, CPackages, CApps, CAdmins, CRoles, ByLaptopType, ByDesktopType, Default

1 comments: