OK, let me give some more details so that you can give me better advice or at least understand the actual problem I am trying to solve. I left out the reason I was doing this because I thought it was too long and convoluted so I simplified the information in hopes of getting a better answer to just my current problem – which is how to parse ListItem custom settings. I hope this is a little bit interesting and that I have explained the problem and my solution clearly. Sorry, this gets a little complicated…
I have a MDT computer objects might get assigned to two (or more) roles. So we have Roles001 = “Role1” and Role002=”Role2” after [CROLES] is processed by ZTIGather Role001 has a value ADGroups that equals “ADGroup1;ADGroup2;ADGroup3” Role002 has a value ADGroups that equals “ADGroup3;ADGroup4;ADGroup5;ADGroup6” The lists of ADGroups for each role are stored as colon separated packed strings in the MDTDB. This is what you see in the dbo.Settings table of the MDTDB. I’m not sure if this is MDT FrontEnd or MDTDB itself that stores the ADGroups ListItem as a packed sting. This is what the ADGroups Column shows in the [dbo.Settings] table in the MDTDB. ADGroups from “Role1” =“ADGroup1;ADGroup2;ADGroup3” and ADGroup from “Role2” =“ADGroup3;ADGroup4;ADGroup5;ADGroup6” When ZTIGather processes tge [RSettings] section of CustomSettings.ini, ZTIGather assigns this like… ADGroups001 = “ADGroup1;ADGroup2;ADGroup3” ADGroups002 =“ADGroup3;ADGroup4;ADGroup5;ADGroup6” Instead of like this… ADGroups001=”ADGroup1” . . . ADGroups007 = “ADGroup6” I think the weakness is that the [RSettings]/ZTIGather doesn’t know how to deal with merging multiple ListItems. It will merge single strings into a list but I doesn’t seem to merge listitems into longer listitems. Either that, or MDT FrontEnd is not storing ListItems into the DB in a way that [RSettings] understands. I suppose it would be possible to write a stored procedure in SQL to somehow return the 7 values from the SQL query on “RoleSettings” rather than the 2 values that the MDT included SQL View “RoleSettings” currently returns with the packed strings, but that is beyond my SQL abilities. It might also work to modify ZTIGather so that if it saw a colon separated packed list for a setting that was defined as a (*) listitem that it unparsed the packed strings into a list too. The way it works today though, there doesn’t appear to be an inbuilt way to do this. Anyway, for me to work around this problem, I had to write my own code to unpack those two (or more) packed string settings into an unpacked listitem setting. And that is why I needed to know how to work with ListItems. From: [email protected] [mailto:[email protected]] On Behalf Of Todd Hemsell Sent: Monday, June 01, 2015 11:35 AM To: [email protected] Subject: Re: [MDT-OSD] Multi-value custom Settings It is a dictionary object, with all the properties and methods of a dictionary object. However I think you should use priorities and not try to parse out multiple values. You are sort of defeating the purpose of the design. On Thu, May 28, 2015 at 8:40 AM, Miller, Todd <[email protected]<mailto:[email protected]>> wrote: No. I am not trying to use the values inside Customsettings.ini The values are created by CustomSettings.ini from the MDT database, but I need to process those settings in a vbscript.wsf script called from the TS. The answer I stumbled into after a LOT of searching is ... ArraryVariable = oEnvironment.ListItem("CustomSetting").Keys And the number of values in the ListItem is oEnvironment.ListItem("CustomSetting").Count It was the "Keys" part i was missing. I think that listitems are set up in MDT as dictionaries, but my array is one diminutional, so it is the "Keys" values that I am after. I had just never tried to process a multi-value (listitem) custom variable before. I think I have this working OK. I think this is right, but if I am going down the wrong path, please respond. ________________________________ From: [email protected]<mailto:[email protected]> [[email protected]<mailto:[email protected]>] on behalf of Keith Garner (Hotmail) [[email protected]<mailto:[email protected]>] Sent: Wednesday, May 27, 2015 4:34 PM To: [email protected]<mailto:[email protected]> Subject: RE: [MDT-OSD] Multi-value custom Settings Does this help: https://keithga.wordpress.com/2014/04/18/listitem-processing-in-customsettings-ini-file/ From: [email protected]<mailto:[email protected]> [mailto:[email protected]<mailto:[email protected]>] On Behalf Of Miller, Todd Sent: Wednesday, May 27, 2015 1:29 PM To: [email protected]<mailto:[email protected]> Subject: [MDT-OSD] Multi-value custom Settings I am having trouble finding an example of how to process multi-valued custom settings. I have two custom lists that will contain between 0 and several values… For example -- CustomSetting001, CustomSetting002, CustomSetting003. The values are set by SQL queries from CustomSettings.ini section [RSETTINGS]. When the computer is assigned to multiple roles, it might have multiple values for the custom setting, and I need to process each. Mostly, I need to figure out how to determine from a ZTI script how to COUNT the # values there are and then figure out how to access each value individually in a loop. In the example above, how would I know there are 3 values assigned, and how would I step through those values individually to perform an action on each. In general, I know what I am doing – just need a little help with these list/array type values. My google skills are letting me down. “List” and “MDT” is a bad google query because hundreds of web pages “list” the MDT standard variables. One idea I had was to just step through all the variables and take an action where the Left(variableName, 14) = “MyVariablename” But there is probably a more straightforward approach, right? ________________________________ Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged. If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited. Please reply to the sender that you have received the message in error, then delete it. Thank you. ________________________________ ________________________________ Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged. If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited. Please reply to the sender that you have received the message in error, then delete it. Thank you. ________________________________ ________________________________ Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged. If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited. Please reply to the sender that you have received the message in error, then delete it. Thank you. ________________________________
