ListItem processing in CustomSettings.ini file.

Got thrown for a loop today when someone on the TechNet forms asked why this CS.ini file didn’t process both the Default and Secondary sections:

[Settings]
Priority=Default, Secondary

[Default]
MandatoryApplications001={AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA}

[Secondary]
MandatoryApplications002={DDDDDDDD-DDDD-DDDD-DDDD-DDDDDDDDDDDD}

When done, only MandatoryApplications001 was processed. Now I would think that the MandatoryApplications item both 001 and 002 would be unique across the INI file, without regard to what section it is in. However that is not the case.

Turns out that within each section, any “List Item” must be a contiguous collection of numbers starting at 001( 001-00n). If you have 001,002,003 and 005 (where 004 is missing) only 001-003 would get imported. In the example above, we are missing 001 in the [secondary] section.

Also, even though there are two sections that contain the unique MandatoryApplications001, when imported ZTIGather.wsf won’t overwrite the 2nd instance of MandatoryApplications001, instead it will just add it to the end of the list.

So for example, if we have two sections with MandatoryApplications lists starting at 001, it should work.

[Settings]
Priority=Default, Secondary

[Default]
MandatoryApplications001={AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA}
MandatoryApplications002={BBBBBBBB-BBBB-BBBB-BBBB-BBBBBBBBBBBB}

[Secondary]
MandatoryApplications001={CCCCCCCC-CCCC-CCCC-CCCC-CCCCCCCCCCCC}
MandatoryApplications002={DDDDDDDD-DDDD-DDDD-DDDD-DDDDDDDDDDDD}

And ran a test with the command:

cscript.exe c:\DeploymentShare\Scripts\ZTIGather.wsf /nolocalonly /inifile:c:\temp\test.ini

Will create the following in the bdd.log:

Property MANDATORYAPPLICATIONS001 is now = {AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA}
Property MANDATORYAPPLICATIONS002 is now = {BBBBBBBB-BBBB-BBBB-BBBB-BBBBBBBBBBBB}
Property MANDATORYAPPLICATIONS003 is now = {CCCCCCCC-CCCC-CCCC-CCCC-CCCCCCCCCCCC}
Property MANDATORYAPPLICATIONS004 is now = {DDDDDDDD-DDDD-DDDD-DDDD-DDDDDDDDDDDD}

Note that [secondary]MandatoryApplications001 is now MandatoryApplications003?

Cool!

Leave a comment