[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1148
  • Last Modified:

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
0
Suk Singh
Asked:
Suk Singh
  • 2
1 Solution
 
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
 
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now