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
- Create a D:\AppSource\QT\Source folder structure
- Copy the Quicktime installation files (msi) to the D:\AppSource\QT\Source folder
- Copy the Install-QuickTime.wsf script to D:\AppSource\QT
- 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
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).