I developed this solution back in 2009, but I never got around to documenting how it would work in practice. It’s not really a feature of MDT, more like a hack for the scenario(s) listed here.
View the last picture of this post to get an idea of what this hack is about. :^)
Say you have an application that requires some additional information from the user during installation. For example, an LOB App that needs to know which local database to connect to run: San Francisco, New York, London, or Beijing? Now optimally, I would recommend a script to try to determine which local server to connect to, perhaps a table of Local Gateways and their associated Database servers. But that’s not always possible.
MDT provides a way to add pages to the LiteTouch deployment wizard, Michael Niehaus even has a tool on his Blog site where you can edit these pages, and create new ones. See: http://mdtwizardeditor.codeplex.com. But are there any other ways to provide UI input options?
A quick reminder about variables in MDT. Variables are typically created in the CustomSettings.ini or BootStrap.ini file, or the Litetouch Wizard, and then variables are consumed by the Stand Alone task Sequencer, and other Litetouch scripts. MDT (And SCCM OSD) all use the *same* namespace for variables. A variable set by the CustomSettings.ini file, can be read and modified by the Wizard, the Task Sequence Engine, the MDT VBScripts, and PowerShell scripts.
Note that when you put a variable in the CustomSettings.ini file, it must be present in the ZTIGather.xml table to be parsed by the ZTIGather.wsf script. If it is a custom variable defined by you, then it must be declared in the [settings] section using the Properties value:
[Settings] … Properties=MyCustomProperty
Private variables that are set in the scripts, do *not* need to be defined in the ZTIGather.xml file, or in the [Settings]Properties entry in the cs.ini file.
Also note that you can pass variables to your application installs through the command line. ZTIApplications.wsf will expand the command line you specified in LiteTouch with variables selected by the % tag. For example:
Msiexec.exe /q /I MyPackage.msi PropertyX=%MyCustomProperty%
MDT provides a wizard page to display available optional Applications for the user to select during installation. This page is displayed using the built in Windows HTML Applications program MSHTA.exe, and renders in a windowed environment.
MDT will parse the control\Applications.xml file in your deployment share, and render the display in in HTML based on the folder structure present in your MDT Console. Several fields are read from the Applications.xml file, including (of course) the name, and the comments.
One of the things that the MDT scripts do is to escape out any HTML tags present in the name and/or the comments. If an unsuspecting IT administrator added a poorly formatted HTML tag like “<table>” without the corresponding “</table>” closing tag in the comments section of an application, then it might cause the *entire* Application page not to display properly with an error to the user.
However for those IT administrators in the “know”, we could use this to our advantage.
The LiteTouch Wizard pages supports the full HTML Application schema, however, there are a few input types that we are most interested in:
<INPUT Name='Something3' type=’radio’ value=’value’ /> <INPUT Name='Something4' type=’checkbox’ value=’value’ /> <INPUT Name='Something5' type=’password’ value=’value’ /> <INPUT Name='Something6' type=’text’ value=’value’ /> <TEXTAREA Name='Something1'>Value</TEXTAREA> <SELECT> <OPTION Name='Something2' value=’Value’>First Item</OPTION> </SELECT>
After MDT renders this page in the wizard, it will look to see if the variable defined by the “Name” attribute has been defined, if so it will automatically fill in this value in the wizard. For example, if Something6 was defined it will fill in that value in the text box above. If Something2 is set to ‘Value’ then that entry will be selected in the listbox.
When you click “next” ( or the “Finish” ) button for each page, MDT will automatically read all the input variables, and set each variable defined in the “Name” attribute to the value selected.
There is a lot of spaghetti code in the MDT wizards to make the pages flow as smoothly as possible for end users, so please be aware that some scenarios may be more complex, but for simple edit boxes, and Listboxes, it should be fairly straight forwards.
As I mentioned above, when MDT renders pages in the Litetouch Wizard, it will escape out the HTML tags for something safe in the system, it converts “&”to “&”, “<” to “<” and “>” to “>”. It does this in the EncodeXML function in the ZTIConfigFile.vbs file. Now if we were to remove this EncodeXML call when processing the Comments section of the Applications.xml file, then we can do some interesting things.
sComments = EncodeXML(oItem.SelectSingleNode("./Comments").Text)
sComments = oItem.SelectSingleNode("./Comments").Text
Now that this code has been modified, any HTML code in the Comments section of the application will be rendered in HTML!
Lets add some HTML code to the comments section of our application:
<select name=AntiVirusServerName> <option value=""></option> <option value="\\AntiVirusUS">AntiVirus NYC</option> <option value="\\AntiVirusUK">AntiVirus London</option> <option value="\\AntiVirusChina">AntiVirus Beijing</option> </select>
Next, let’s modify the command line for our installation program to use the “AntiVirusServername” variable defined above:
cmd.exe /c RunSetupCommand.exe /Server:”%AntiVirusServerName%”
Now we have a flexiable way add extra parameters to applications, and have them display associated with the corresponding application.
Danger! Remember, if you add in poorly formatted HTML code to the comments section of any Application, Language Pack, or Task Sequence, you may crash MDT, and create a bad user experience, So please be careful when using this Feature/Hack.
*WHEW* that was a bit log, but I hoped you find it useful ( or at least informative).