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

Hi,

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
Suk SinghAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

oBdACommented:
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!
		pause
		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'!
			pause
			goto :eof
		)
	)
)
pause
echo Done.

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Suk SinghAuthor Commented:
Hi,

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?
0
oBdACommented:
The script would copy and install the msi files in the order in which they are listed in the "MsiList" variable.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.