Nesting sections in CustomSettings.ini

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
image

Happy deployment

/ Johan

About the author

Johan Arwidmark

0 0 votes
Article Rating
Subscribe
Notify of
guest
1 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
AdamN
AdamN
7 years ago

They're future properties you can modify

Using Stockhom and London as example. When we look at AD forest and OU each site has specific area based on site/location

In MDT, We can set a generic OU path and reference a custom property in the OU and detected based on gateway settings
Avoding any need for custom scripts or changing the OU manually

I just dont have the code with me atm to copy/pasta and provide an example


>