Can the resulting command line be determined after

2019-03-01 13:02发布

If I want a silent install, is there any simple way of running the installer, selecting the desired options and then determining the msiexec options/switches necessary for an equivalent installation? (Preferably without actually installing anything - not clicking finish)

Or is digging through the MSI database all you can do to find the desired properties?

2条回答
放我归山
2楼-- · 2019-03-01 13:48

UPDATE, Aug 2018: Consolidating a header section with extracts from the full "answer" below - trying to emphasize the parts that seem to make sense.

Log File CommandLine: Just thought of another option. If you log your MSI install, then you can search the resultant log file for the entry CommandLine and see what the command line the setup is running with actually is (linking a related answer for easy retrieval). Log your install: msiexec.exe /i C:\Path\Your.msi /L*v C:\Your.log (logging details). The log file should also enumerate all property values set in the setup during installation - but that is elsewhere in the log (the CommandLine entry shows only the command line specified). No guarantees that this command line is always correct, but give it a spin?

Transform Generation Tools: Several commercial tools provide small components that allow the capture of MSI GUI settings during "dry runs" - which seems to be the core of what you ask (I try to make answers generic and useful for others as well - sorry if that confuses things). Please see this answer for details: Generate Mst response tool. I don't think these are re-distributable, so you can't deliver them to your customer. You could ask the vendors if they allow re-distribution though? If you do - let us know? I do not have sample code to allow you to roll your own tool - unfortunately. There could be something on github. Not rocket science, but everything takes time.


Customizing Silent Install

It seems you simply want to replicate the same install on many computers? (corporate large scale deployment done by pros). Or do you want to allow your users a generic tool or approach to help configure your install? (setup customization in general for any end user). I'll write up a generic overview hoping to answer both. The deployment pros generally know what to do, they need to know what not to do - what is unusual about your setup - if anything at all.

You can customize an MSI installation in several ways, but the most common ways are to use batch files / command line paramenters or transform files - often combining both. The following answer describes these two approaches in more detail: How to make better use of MSI files. In theory you could invoke the install programmatically as well - for example using MSI API (COM automation) - which is rarely done. MSI API and Win32, COM and DTF / .NET.


Approaches

Based on the above two main approaches or mechanism, I suppose we can list a few real-world options for setup customization by end users - deployment pros or not.

Several of the below approaches can be combined with success - so you have a default batch file set to install a default transform file and you have a PDF document explaining normal installation parameters and further options - and things that should not be done. The default transform file is tweaked by the end user (license key, connection strings, URLs, shortcut locations, what features to install and not, etc...)

Standard Transform: I suppose you could deliver a standard transform file *.mst which contains your default settings? But why not make those settings the default for the install outright? Perhaps you want different settings for different regions? You could deliver several standard transforms for different purposes.

Batch Files: You could create a bunch of batch files with different "default" settings and let the user use the one they need? With inline information on what to set - for example license keys, etc... You can use a batch file that sets only PUBLIC property values, or you could use a batch file along with the standard transform mentioned above. Transforms are heavy-weight customizations, properties are light way customizations.

Administrative Installation: I have never seen it done, but I suppose you could have a custom action in the administrative install sequence that would generate a batch file with the parameters you have set, or even generate a transform file with the same settings? The administrative installation does not show your regular MSI GUI though - so this sort of makes it a double effort as you have to create a "settings generator GUI" for your administative installation GUI sequence (there are separate GUI sequences for regular install, admin install and advertised install). also mentioning the AdminProperties property concept - I am frankly unsure how it works. I have never used it.

One Page PDF: My preferred approach is to provide a one-page PDF document called Large Scale Deployment Guide.pdf (or "Silent Deployment" or similar). It describes with maximum minimalness the different installation options available and what they mean. And what not to do. Several sample command lines are shown. Pros will understand what to do in seconds. List full runtime requirements! (prerequisities, runtimes). Explain what not to do ("...don't disable these custom actions, and here is why...").


Some Links:

查看更多
可以哭但决不认输i
3楼-- · 2019-03-01 13:57

Yes, it sounds like you need to create a response transform (MST). A lot of the tools linked to above are premium tools (not worth paying for a response transform!!) but I used this a while ago (this tool is free) and it seemed to work well:

http://www.jontylovell.net/index.php?page=10

Once you create your response transform with your installation configuration, you then need to specify the transform on the command line with:

MSIEXEC /I {Path To MSI} TRANSFORMS={Path the response MST} /qn
查看更多
登录 后发表回答