In MDT rules processing with CustomSettings.ini, some of the items that can be configured are List Items. List Items are essentially multi-valued custom properties. Examples of items that are List Items are Applications in LTI and Packages in ZTI. To define a List Item based property in CustomSettings.ini you add the base property name in the Properties line in the Settings section in the form Propertyname(*) if it is a custom List Item. Then in the section(s) where you want the to define the values for the List Item, you add them in the form of either Propertyname1=value or Propertyname001=value. The numeric suffix should start at 1 or 001 and increment by 1. Below is the example for the Packages List Item property from the MDT help file:
Since this is an MDT-defined property, it does not need to be listed in the Properties line. Below is an example of a custom List Item (additions in blue):
UsmtExcludeRootFolders012=C:\System Volume Information
The list of folders in this example is one of several lists that a custom script of mine consumes and generates a custom USMT XML file. When I was first doing this with standard MDT List Items I found several things really frustrating. The first was the numeric suffix. The numeric suffix must be in numeric order and there must be no repeated numbers and no gaps in the number sequences. If you don’t do this, not all the items will be processed. I like to keep the folders in alphabetical order so that when I need to add or remove one, it is easy to find the place to add, delete, and make sure I’m not adding a duplicate. So when I have to add an item near the top of the list, painful tedious re-numbering would have to be done.
Also, MDT rules processing expands all variables in values placed on CustomSettings.ini. So the special folder variables at the beginning of the list would get expanded to the value for that folder on the source OS. However, I actually wanted the exact text (without variables being expanded) placed in the List Item.
So to get around these limitations I created a User Exit script to implement what I call Easy List Items. Here is the previous example done as an Easy List Item (additions in green):
AddUsmtExcludeRootFolders=#AddToListItem(“UsmtExcludeRootFolders”, “ExcludeRootFolders”, “”, False)#
UsmtExcludeRootFolders=C:\System Volume Information
As you can see from this example, the AddToListItem function in EasyListItemExit.vbs allows you to add all the List Item entries without the numeric suffix. You can now reorder, add, and delete items without worrying about number order or gaps in the numbering. And because this function simply adds to the List Item if it already exists, Easy List Items can coexist with standard MDT List Item entries.
The parameters for the function are the List Item name, the section to process for entries to add, the INI file path (blank for the current INI file), and True (expand variables) or False (don’t expand variables). The INI file parameter allows you to query additional INI files for entries. In this example the custom property AddUsmtExcludeRootFolders that causes the AddToListItem function to run will have a value of Success or Failure (if the List Item entries, section name, or INI file cannot be found).
The script can be found in the Zip file below.
This post was contributed by Michael Murgolo, a Senior Consultant with Microsoft Services – U.S. East Region.