• Home  / 

Using applications in MDT 2010 (VBscript vs Batch files)

By arwidmark / January 18, 2011

Over the years I have been answering quite a number of posts from people trying to run batch files in MDT. And as fun as the old batch files ever are, you simply get way more features when converting them into vbscript…

Here is the deal, MDT does support batch files, but batch files has quite many limitations compared with vbscript. The most common issues relates to the working directory and UNC paths, using pushd and “%~dp0” for temporary mappings. Others relate to calling cmd /c before the actual command etc, not to mention the lack of “real” objects…

By converting the batch file into a vbscript we can take advantage of all the object properties in MDT, get a better error handling and logging. Shorthand – it will just work. On top of that we can have a common standard on how we deploy applications.

Here is a sample batchfile from one of the forum posts that installed quicktime 7, the post was about the batch file not working correctly with MDT.

REM Install Application Support first:
AppleApplicationSupport.msi /quiet /passive /norestart

REM Install Quicktime
QuickTime.msi /quiet /passive /norestart ASUWISINSTALLED=0 APPLEAPPLICATIONSUPPORTISINSTALLED=1 DESKTOP_SHORTCUTs=NO QT_TRAY_ICON=NO SCHEDULE_ASUW=NO

REM Delete the AutoRun key
reg delete “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run” /v “QuickTime Task” /f

Rather than even spending a minute on debugging the batchfile I converted into a vbscript that you can download: QuickTime 7 installation script for MDT

Instructions:

  1. Create a D:\AppSource\QT\Source folder structure
  2. Copy the Quicktime installation files (msi) to the D:\AppSource\QT\Source folder
  3. Copy the Install-QuickTime.wsf script to D:\AppSource\QT
  4. Create an application in MDT, set the source path to D:\AppSource\QT when importing, and set the command-line to cscript.exe Install-QuickTime.wsf

Notes:

When deploying the app you get additional logging the in the C:\MININT\SMSOSD\OSDLOGS from the script itself as well as the individual msi installs.

For testing purposes it’s very useful to create a custom task sequence that only installs the QT application, and execute that sequence from the running OS (so that you don’t have to do a full deployment every time you need to test an app).

/ Johan

 

About the author

arwidmark

tjennings - January 18, 2011

This is great man. I can’t thank you enough, unless of course, you could provide some links to appropriate information/books/training resources for MDT 2010 and vbscript.

I’m currently bookmarking a few places on the web that offer training and searchable indexes for VBS, but any links you could throw in regarding VBS in MDT2010 would be MUCH more helpful and precise.

Thanks again!
Not So Frustrated Now

tjennings - January 18, 2011

P.S.
Great blog! I just realized that I’ve been using you occasionally for information/tutorials on setting up WDS on server 2008 r2. You’re at the top of many of my Google searches on these topics.

Don’t mean to hound you for links, either, but I believe that it is better to learn and do than to rely on others to do for you.

arwidmark - January 18, 2011

List of MDT 2010 Resources
http://www.deployvista.com/Blog/JohanArwidmark/tabid/78/EntryID/161/language/en-US/Default.aspx

/ Johan

Seanlv - March 31, 2011

In the step 4, set the command-line to cscript.exe Install-QuickTime.wsf

My question is how to hide the windows when loading cscript.exe?

Thanks

arwidmark - April 20, 2011

You can wrap cscript in another executable, see this post… disclaimer, I have not tested this myself, but Alex is trustworthy 🙂

http://blogs.msdn.com/b/alex_semi/archive/2009/11/30/suppress-cscript-windows.aspx

Naz - May 19, 2011

Hi Johan,

I should have joined this blog ages ago but better late than never
I have a question – have you posted anywhere on how to create a custom task sequence that install single applications – I have having some issues with installing apps – even though when I install them with the switches on command line it works

Regards
Naz

arwidmark - May 25, 2011

It’s just about creating a new task sequence, and select the custom template. Then you can go into the task sequence and select the application, or add it as applications001={app-guid-from-the workbench} in customsettings.ini. The app needs to run fully unattended.

/ Johan

RoBL - November 14, 2011

Hi John, Is there a way if 15 applications are offered to select for installation, and let’s say within 10 minutes, if no app is selected the deployment continues to install the OS automatically. Now it will wait for ever…

Regards,

Rob

arwidmark - November 14, 2011

You can certainly customize the deployment wizard to wait, and automatically continue if no selection is made, but for that you need to change the code in the HTA.

/ Johan

Dapim76 - November 21, 2011

Can you use the QTime script for other apps as well? Obviously substituting the executable and so forth. I am new to MDT and I need to get this up fairly quickly and we only have a handful of apps that go on our PCs.

arwidmark - November 22, 2011

Sure, that works fine… If the application have good installer you can also call it directly, I just prefer to use application wrappers for consistency, and to get additional logging.

/ Johan

RobVM - January 12, 2012

The script worked fine for me with QT 7.7.1, after I remmed out the line that deleted the startup registry key. It appears that key doesn’t exist.

Comments are closed