How to use VBScript in your MDT/SCCM CustomSettings.INI.

By | November 17, 2011
Share

The built-in CustomSettings.INI variables are very useful, but in some occassions they are simply not enough. For instance, the “Model” variable contains the FULL model number (ie. CF-19K4RAX2M). What if I want to create a section breakout for all CF-19 laptops? Here is a method I found to perform this task:
1. First you must tell your “ZTIGather..” script to look out for a new variable, which is ShortModel in my example. Add a line to the “<DeploymentShare>\Scripts\ZTIGather.XML” file, which is read by the ZTIGather.wsf prior to combing your CS.INI matching variables.

<property id=”ShortModel” type=”string” overwrite=”true” description=”Short Model Number” />

2. Next add the following lines to your CS.INI:

;Tells ZTIGather to look in the “RunFirst” section first,
; which will populate the ShortModel variable, which in
; turn be replaced when searching for the “ShortModel”
; section.
Priority=RunFirst, ShortModel, Default

[RunFirst]
;Example output will be CF-19 instead of CF-19K4RAX2M
ShortModel=# LEFT( oEnvironment.Item(“Model”),5 ) #

;Now I can add my CF-19 section
[CF-19]

Another very useful easy CS.INI code block I use to add VBScript and more intelligence to my CS.INI. Is a custom Variable, which contains a specialized formatted Date to my liking. I can use this variable wherever I like and whenever I like throughout my ENTIRE Deployment (TS included).
1. Just as I did before I add the variable to my “ZTIGather.XML” file to tell my ZTIGather.wsf to look out for the variable in my CS.INI.

<property id=”SpecialDate” type=”string” overwrite=”true” description=”Special Date Value” />

2. Then I populate it wherever I like in my CS.INI

SpecialDate=#DatePart(“M”,Now) & DatePart(“D”,Now) & DatePart(“YYYY”,Now)#

-Brian G

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.