We have an installer package that has certain properties that we place into a .ini file. Sometimes we override the default values of these properties by passing PROPERTY=value to msiexec command line to change the settings in the ini file, now we have got this working on upgrades by making the entry in the ini file to 'Create or update' and by making its component 'Permanent'.
We also want this ability when performing repairs; i.e. when executing the following command 'msiexec /fa package.msi PROPERTY=new-value' we would like the ini file to get the new value.
This does not seem to be working currently, it just places the property's default value into the ini file. I assume the new property value is not used in the repair.
Please advise.
Attached you can find an example project that reproduces this.
We are aware of this problem and it looks like this is an Windows Installer limitation. The problem was also discussed in the /FA command Questions thread.
The problem is that we require it to be automated with no user interaction for deployment of the msi package.
Are you aware of any additional commands we could pass in to the /i option to install and repair without a UI. I've tried using it with /qn and /qb with the same version and it doesn't run a repair.
On the other hand we are not able to easily detect if the version that is installed is the same version that we are attempting to install or repair. Since typically we would run an msiexec /i if it is an older version and an msiexec /fav if it is the current version.
We required this since it is for automated software deployment, so these would run with the /qn option.
But if it is possible to run msiexec /i with the UI and then repair can be selected, do you know if we can do this dynamically in the MSI installation process, eliminating the need for us to detect whether we need to run msiexec with the install or repair command.
So in summary, when running msiexec /i package.msi /qn, can we detect if the version that is installed is an older version or the current version and put the installation in install or repair mode respectively?
I'm afraid you cannot run an MSI with the "msiexec /i package.msi /qn" command and than put the installation in install or repair mode based on a condition.
I will describe below a workaround for your problem and also attach a sample project, so you can take a look on it. Steps to follow:
- create the MSI you want to install via command line (i.e. MainMSI)
- create another MSI that will contain the "MainMSI" package as a "Feature-based" prerequisite (i.e. ContainerMSI)
- go in the Install Parameters page and create a new property (i.e. Name: PROP, Value: default in case you want to pass a value to the "MainMSI" package as you said in your first post)
- go in the Prerequisite page and add the "MainMSI" package in the "Feature-based" folder twice and rename them (i.e. "NewerVersion" and "SameVersion")
- go in the "Setup Files" tab of the "NewerVersion" prerequisite and in the "Silent (No UI)" text field write the following command: /qn UPDATED.PROPERTY=[PROP] (this command will run in case the "ContainerMSI" package is launched silently)
- go in the "Setup Files" tab of the "SameVersion" prerequisite and in the "Silent (No UI)" text field write the following command: /fav /qn UPDATED.PROPERTY=[PROP] (the "PROP" property is passed to the "UPDATED.PROPERTY" from the "MainMSI" package)
- go in the "Install Conditions" tab and check the "Always install prerequisite" radio button for both prerequisites
- go in the Search page, create a "Product Version (identify by Product Code)" search, select the "MainMSI" product code and rename the search i.e. PROD_CODE (this search must be modified every time you increase the version of the "MainMSI" package)
- go in the Organization page, select the "NeverVersion" feature, check "Install based on condition" radio button and set the condition: NOT PROD_CODE
- go in the Organization page, select the "SameVersion" feature, check "Install based on condition" radio button and set the condition: PROD_CODE
- build and run the project
Now, you can run the following command in an elevated console: msiexec.exe /i ContainerMSI.msi /qn PROP=newValue and have the following three behaviors:
1. If the "MainMSI" package is not installed it will be installed with the following command: /qn UPDATED.PROPERTY=[PROP]
2. If the "MainMSI" package is already installed with the same version the following command will run: /fav /qn UPDATED.PROPERTY=[PROP]
3. If an older version of the "MainMSI" package is installed the following command will run: /qn UPDATED.PROPERTY=[PROP]
Please take a look on the attached project and let us know if you have any question.
FOLLOW US
Get the latest news in Application Packaging