Back to Basic: Application deployment in MDT using a VB Script wrapper

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!2195


Categories: Deployment, MDT

7 replies »

  1. Mike,

    Thanks so much for posting your VBScript wrapper. I’ve been using batch wrappers with MDT for the longest time and am just now starting to try and convert them VBScript and PowerShell. I knew enough to know that thee was probably a good” stater template” out there that could kickstart me on sume best practices but had not come across anything MDT-focused yet. I really appreciate your willingness to take the time and post this.

    • Yes, one simeple way is to create a custom Tasksequence that contains only the steps you would like to test, then you run that taskaequence using cscript.exe \\server\share\scripts\litetoch.vbs or if you just need to test all the varibales in custimsettings.ini you could run cscript.exe \\server\share\scripts\ztigather.wsf /inifile:\\server\share\control\customsettings.ini

  2. I answer to my self :O) Script dont have to be in scripts folder. I was wondering why script wont work when i make it as an application in mdt. Although it worked when i run it in working os. The problem was i forgot to add cscript.exe command as quiet install command . So to run the script as application during mdt installation quiet isntall command is cscript.exe Install-Lync.wsf.

Leave a Reply to Jouni J Cancel reply


You are commenting using your account. Log Out /  Change )

Google photo


Twitter picture


Facebook photo


Connecting to %s
