To automate the installation of an MSI package, you can use the /I option, like this:
msiexec.exe /qn /i mypackage.msi
Keep in mind that you need to specify the properties the MSI package expect the user to specify through the UI, and for which it does not have a default value.
You can use the Orca tool to see the list of properties and fiddle around with MSI conditions, etc. And to set values for the properties, you can just specify it in command line; e.g. to set a property ISDEBUG:
msiexec.exe /qn /i mypackage.msi ISDEBUG=1
Side note: To automate uninstall, use the /X option with the package or the product code:
msiexec.exe /qn /x mypackage.msi
or this (where you need to change the CLSID with your product code):
msiexec.exe /qn /x {B741B8A3-8DCB-44E0-B06F-2A11F56572DB}
Well, there is the free way and the $$$ way. I cannot document everything here, but this should get you started.
On a side note, yes, Windows Installer is a maddening technology. There are many times where I think a task will be straightforward, but it actually becomes complicated. You definitely have to immerse yourself to understand it.
In any case, here goes:
Free: WiX (here)
This is a free tool to generate MSI files from a set of XML configuration files. I'll leave you to find tutorials online, but here is the crux:
You can compress your EXE into the installer by using the following tag in the WXS file:
<Binary Id="MYEXE" src="<path to my exe?"/>
Then you can create a custom action which launches your EXE file:
<CustomAction Id="EXECA_CALLMYEXE" Return="check" Execute="deferred" BinaryKey="MYEXE"
ExeCommand="my command line"/>
Then you insert your custom action into the InstallExecuteSequence
in the appropriate spot (I almost always run mine somewhere between InstallInitialize
and InstallFinalize
)
<InstallExecuteSequence>
<Custom Action="EXECA_CALLMYEXE" After="InstallInitialize"><![CDATA[Not REMOVE]]></Custom>
$$$: Get InstallShield (HERE)
First create a "Basic MSI" project and make sure you say you want no setup.exe generated. You set this in the Release settings.
Then you essentially do the same thing as with WiX, but you have a UI for it.
- You can specify your helper EXE file by using the Direct Editor and putting your EXE file in the 'Binary' table
- You can create a custom action to launch that EXE file from the "Custom Actions" Node in the tree on the left
- You can insert the custom action by selecting "Install Sequences" and putting it in the
InstallExecuteSequence
somewhere between InstallInitialize
and InstallFinalize
as I said before.
Sorry, I could not be more detailed, but this should be a good start.
Best Answer
/qn no UI
/quiet no user interaction
/passive unattended mode (only progress bar)