Can I Run Windows Installer (msiexec) from a Windows Batch File?

user2135970 picture user2135970 · Jul 15, 2014 · Viewed 8.5k times · Source

Ok, I'm out of my element but here goes anyway.

I need to do a silent install of a vendor supplied windows program. The vendor supplied an MSI file to use with the install. I created a bat file to run msiexec that contains the following line:

msiexec /i "C:\archibussilent\afm\ARCHIBUS 19.msi" /L*V C:\archibussilent\log\msi_SETUP.log

When I execute the bat file an error dialog pops up that says:

"This installation cannot be run by directly launching the MSI package. You must run setup.exe"

and the msiexe error log says:

MSI (c) (80:B0) [15:48:02:588]: Note: 1: 1729 
MSI (c) (80:B0) [15:48:02:589]: Product: ARCHIBUS 19 -- Configuration failed.
MSI (c) (80:B0) [15:48:02:590]: Windows Installer reconfigured the product. Product Name: ARCHIBUS 19. Product Version: 19.3.30032.003. Product Language: 1033. Manufacturer: ARCHIBUS, Inc.. Reconfiguration success or error status: 1603.

The error # is 1603 which implies a permissions problem but I've checked the access privileges and don't see any problem.

Is it true that I can't run msiexe without running Setup.exe?

Any help is appreciated - Thanks.

Answer

Christopher Painter picture Christopher Painter · Jul 15, 2014

The "you must run setup.exe" is a vendor authored requirement not specific to MSI in general. They may have had a good reason for it or they may have just authored it as a gate check to not have to test other scenarios.

You'll have to edit the MSI with ORCA and look at the LaunchCondition and InstallExecuteSequence tables to figure out how they implemented. Then you can create a transform to bypass the check or possible pass a property in such as SETUPEXEDRIVEN=1 to simulate being called from setup.exe. (One particularly large and well known installer development product passes this into their MSI when you create a setup.exe with it.)

The setup.exe may be serving a purpose. For example it might be authored with a manifest requiring elevation or it might be downloading and installing prerequisites or possible making sure the MSI is cached in a given location for future installation transactions.

Also I assume you want to add a /QB or /QN to make the install go silent. You'll like also need to have already elevated the cmd session prior to calling since MSI doesn't support UAC prompts when installing silently.