In a previous Post (Making custom database and webservice scripts work again in MDT 2010) I wrote already about some changes in MDT 2010 which make it necessary to update your custom scripts if you are dealing with database and/or webservice calls.
Recently I had to upgrade some custom wizards making some webservice calls directly from the wizard (similar to the example posted on Create your custom boot wizard - Display dynamic data). I updated the information about the namespaces and gave it a try, but it was still failing. The problem is, that the Wizard provided with MDT 2010 does not load the ZTIDataAccess.vbs which is necessary to access any data source. The wizard only loads ZTIUtility.vbs on default. in MDT 2008 this was ok as ZTIUtility contained all the Data Access Functions so you could utilize them to e.g. create a list of Roles directly from a webservice. But as we know, this has now been moved to it’s own file ZTIDataAcces.vbs.
OK, how do we fix this?
The easiest solution is simply reading the content of ZTIDataAccess.vbs dynamically into the running script. Sounds a bit strange but is not as hard as it sounds. Michael Niehaus posted this recently in a Blog Post (Michael Niehaus - MDT 2010 Wizad Example: Role Selection). The following snippet has been taken from his example:
sScript = oFSO.OpenTextFile(oUtility.ScriptDir & "\ZTIDataAccess.vbs", 1, false).ReadAll
On Error Resume Next
ExecuteGlobal sScript
On Error Goto 0
Looking at this snippet, it will try to load the file and read the content. Then make the content available “globally” by using a helper function called “ExecuteGlobal”. Now the content of ZTIDataAccess.vbs is available for the script and your current database and webservice calls will work again.
But you have to do this for every script you are utilizing with the wizard. A more elegant solution would be to have the wizard loading this on default. To be able to achieve this, we need to make a small change in the wizard itself. Yes I know, this is a custom hack, it won’t be supported by Microsoft and you have to redo it again if they update MDT. So you have to ponder this yourself ;-)
The “fix” itself is quite simple. Just open the wizard.hat in a texteditor of your choice and search for “ZTIUtility.vbs”. You should end up in line 41 of the wizard.hta. Copy the whole line and paste it in as a new line below the current block of references. In this just pasted new line rename “ZTIUtility.vbs” to “ZTIDataAccess.vbs” and save your changes. This should now look similar to this:
If you now place this updated wizard.hta in your “{MDTInstallationFolder}\Templates\Distribution\Scripts” folder (after making a backup of the original file ;-) ) it will be used in all new Deployment shares and Boot images/medias. On existing ones you probably need to update this by hand.
From my personal point of view, a long term solution would be to have the MDT Team referencing the ZTIDataAccess.vbs as default in their wizard, as getting information from different sources is an essential feature. At least for me and probably most others ever utilizing this to dynamically influence the deployment. It has been available in the last version so I hope they will make it available again in a future Update/Version.