Earlier today I got a question on how to nest sections in CustomSettings.ini to create a computer name. Here is how!
Note: For the record, I don’t recommend generating complex computer names based on site,laptop etc. Keep the computer names to a syntax PC+sequence or something like that (example PC00075). Easy to read, easy to keep track of etc. However, the nesting technique demonstrated here can be used for many things.
Multiple Sections
In this example you see multiple settings, and a few custom values, coming together to form a computer name based on location, computertype and serialnumber. As usual when playing around with rules in CustomSettings.ini, use this PowerShell script to simulate the settings. Save time (and avoid pain) - Create a MDT simulation environment
The important part in the below script is the priorities, a custom variable must be set in once section, before it can be used in another. That’s why the OSDComputerName variable is set in the Default section, which is last in the order (what order the section has within the file itself is irrelevant, it’s the priority line that controls it).
[Settings]
Priority=DefaultGateway, ByLaptopType, ByDesktopType, Default
Properties=ComputerLocationName,ComputerTypeName
[Default]
OSDComputerName=%ComputerLocationName%-%ComputerTypeName%-%SerialNumber%
[DefaultGateway]
192.168.10.1=Stockholm
[Stockholm]
ComputerLocationName=S
[ByLaptopType]
Subsection=Laptop-%IsLaptop%
[ByDesktopType]
Subsection=Desktop-%IsDesktop%
[Laptop-True]
ComputerTypeName=L
[Desktop-True]
ComputerTypeName=D
Happy deployment
/ Johan
More ...