Last week someone asked me why I use a VB Script as a wrapper when I deploy applications in MDT and that is good question and luckily there is an answer, or a whole bunch of different answers I would say. But instead of going a boring list of benefits, let us pick a random application.
Microsoft Lync 2010. This application is very simple, or should I say applications since there is one for the x86 and one for x64 architecture, so you need to create two applications and set conditions to both of them and then you could create a bundle that contains them both with conditions, yeah, that works. But that would not give me logging, it would not give me error handling and it would not give flexibility to use all the MDT variables inside the VB script as parameters, which very convenient.
Installing Lync 2010 using a VB Script wrapper in MDT
Basically all these script looks the same, they all start with the same (more or less) and they end the same. That is because we are using a template more or less. So the interesting part is the between Function ZTIProcess and End Function, since the action is there.
First we need to Dim everything that is not already within the MDT solution, in this case sFile and sApplicationName, then we set the application name so I cab reuse that in the rest of the script. Then we use the built-in function for logging, called ologging. It becomes available when we load the ZTIUtility.wsf (which is loaded in the top of the script). Next step is to determine on what platform we are running and what file that should be used. Then we verify that the file exist and then we run the application with switches using the run with heartbeat (an other built in feature in ZTIUtility) and the we create log files for this. And if you look at this you should realize that is not that complicated to re-use this for other applications by changing the name of the executable and the script file.
Download the file here