I have a MSM file from a third party tool.
We customize the MSM with a small script and this tool is integrated into our installer and works fine. All modification is done with VBscript using COM and "WindowsInstaller.Installer"
But sometimes our support needs just this tool as standalone installer package.
Is there a simple way to convert a MSM file into and full installer MSI package on the command line?
Using VBscript or the COM Module with the "WindowsInstaller.Installer" is OK. Knowing the way how to to convert it, I would also write a small C++ program doing performing the changes and setting the appropriate information and conversion.
I need to command line to, to integrate the MSM conversion into our build process.
What I searched and found:
I saw some tools like ORCA and other MSI tools in the SDK, but none of some are doing what I need. ORCA can save an MSM as a MSI file but I can't see options doing this on the command line.
Note: I found an old tool msm2msi, but it doesn't work with my MSM file and crashes, and there is no source available.
Edit About the changes we apply:
The reasons for the change are simple. The thirdparty module has a "so called server mode" usually it is only used on 1 machine, but the MSM enables it for every machine. So wie decided to disable it, in changing a property. And some more changes.
So it is more about the primary installation. When an update comes, this settings are never touched.
Also the MSM installs its own UI, that we don't want and need. All controlling is done through our software... So we install the components but we remove that menu entries in the Start folder.
Any MSI Tool can consume an MSM file and compile a MSI from it, with whatever additional constructs you want - conceivably also the changes you make to the MSM?
The free and open source WiX Toolkit would certainly be able to compile an MSI from an MSI via the command line, and it is free and open source as well. WiX Quick Start Suggestions.
However, there is cause for concern with regards to the modifications you intend to make in the MSM. This is very bad news indeed, since MSM files are specifically made to not be change by end users. It would be very good if you can find an alternative way to do the changes needed, for example custom actions inside the MSI file you compile.
Although WiX is quite involved at times to deal with, merging and MSM could not be simpler:
<DirectoryRef Id="TARGETDIR">
<Merge Id="VCRedist" SourceFile="MySourceFiles\Microsoft_VC80_CRT_x86.msm" DiskId="1" Language="0"/>
</DirectoryRef>
<Feature Id="VCRedist" Title="Visual C++ 8.0 Runtime" AllowAdvertise="no" Display="hidden" Level="1">
<MergeRef Id="VCRedist"/>
</Feature>
Full sample here: How To: Install the Visual C++ Redistributable with your installer. And the documentation: Merge Element.
Why do you want to merge this MSM every time? Is it continually updated? If so, can the vendor change it so that you do not need to post process it? If it is not updated, can you just change the MSM itself? Not great to do - in fact quite terrible - but it might be less error prone than continuously fiddling with its settings.
Transforms & msiexec.exe: With your updated information I would say that you can solve all of this by using a transform, or possibly even by setting a property via the installation command line.
Transforms allow you to change "anything" in an MSI / MSM (they are little database fragments applied at runtime to change the MSI / MSM), setting a PUBLIC PROPERTY (always uppercase) allows you to affect whatever that property is designed to affect. So the latter is a "light weight" customization of the MSI / MSM added and supported by the vendor, that is great when available but in my experience rarely sufficient (typical use is to add a license key or a server IP or URL or install only part of the MSI - a few features - simple stuff like that).
Descriptions of how to use transforms
or the msiexec.exe
command line to customize an MSI installation can be found here:
- How to make better use of MSI files (elaborate)
- How to run an installation in /silent mode with adjusted settings (short form - section "MSI - Customize Standard Package")
GUI: I really don't understand what you refer to when the MSM "installs in its own GUI"? Hopefully this is just a shortcut to launch an executable from the start menu? If so you can easily remove it using a transform.
Create Transform: You can create transforms using Orca (MS SDK tool) or any other MSI Deployment Tool, or you can create it programatically using the MSI API (Win32, COM, .NET).
COM Automation: The Microsoft MSI SDK contains a VBScript called WiGenXfm.vbs. You will have it installed if you got Visual Studio installed. You could also find it on github.com (but get it from your own disk to be sure).
DTF / .NET is a component of WiX which allows you to access the MSI API via managed code. The interop is done for you. Sample here.
C++ / Win32: And down-to-the-metal Win32 (accept no substitute - layers be gone :-)).
Note: DTF is installed as part of the WiX toolkit. The open source toolkit capable of building MSI files (quick start suggestions). After installation find the dll's in the WiX installation folder under %ProgramFiles (x86)%
. Sub folder "bin". File descriptions here. And I will end with a quick sample of DTF in action getting some properties from an MSI file.