VB Script or Command script to install multiple MSI's in one go silently with surpressing the reboot

Posted on 2014-08-20
Last Modified: 2014-08-22

I am looking to install mulitple MSI files silently without forcing the user to restart. I would like this automated and would like to set the directory as well for where the MSI's should reside on the local drive C.

What I have so far which works for one MSI is the below:

Set MSIPackage=file.msi

Set PackageDir="c:\test\packages\file"

If Exist %PackageDir% (
      copy /y %MSIPackage% %PackageDir%
) Else (
      md %PackageDir%
      copy /y %MSIPackage% %PackageDir%

MsiExec.exe /i %MSIPackage% REBOOT=ReallySuppress ALLUSERS=2 /l c:\test\packages\file\%MSIPackage%.log /qn
Question by:Suk Singh
    LVL 82

    Accepted Solution

    So the msi files are all in the same directory as the batch script, and they should all end up in the same local directory? Then try this; it's in test mode and will only display the msiexec commands it would normally run; remove the uppercase ECHO in line 26 to run it for real. The script will currently pause and wait for user input before leaving or if an error occurred:
    @echo off
    setlocal enabledelayedexpansion
    set MsiList="file1.msi" "file2.msi"
    set PackageDir=C:\test\packages\file
    if not exist "%PackageDir%" (
    	md "%PackageDir%"
    for %%a in (%MsiList%) do (
    	echo Please wait, copying '%%~nxa' ...
    	copy /y "%~dp0%%~a" "%PackageDir%"
    	if errorlevel 1 (
    		echo ERROR: source file '%~dp0%%~a' not found!
    		goto :eof
    for %%a in (%MsiList%) do (
    	echo Please wait, installing '%%~nxa' ...
    	ECHO start "" /wait MsiExec.exe /i "%PackageDir%\%%~a" REBOOT=ReallySuppress ALLUSERS=2 /l "%PackageDir%\%%~na.log" /qn
    	if !errorlevel! equ 0 (
    		echo ... OK.
    	) else (
    		if !errorlevel! equ 3010 (
    			echo ... OK, reboot required.
    		) else (
    			echo ERROR; errorlevel was !errorlevel!; see log file '%PackageDir%\%%~na.log'!
    			goto :eof
    echo Done.

    Open in new window


    Author Comment

    by:Suk Singh

    Thanks, would this run in a loop to make sure all the msi's files are installed? Some are reliant on others to be installed. Or should I write the MSI file names in order for it to be installed?
    LVL 82

    Expert Comment

    The script would copy and install the msi files in the order in which they are listed in the "MsiList" variable.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
    Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now