simonr
Posts: 2
Joined: Fri Feb 03, 2017 3:36 pm

Unattended Installation – How to Set Public Properties

Hello,

We are having issues with sending values for properties in silent installation on update. We would like to change value of property which has enabled "Set persistent property". This work as expected when executing normal install, but when executing silent install, values passed with command are overridden by values in Registry.

Reproduction:
1. First installation of package with property which is marked as persistent on Test machine.(Doesn't matter, works with normal as well as silent installation)
Value used in setup is correctly set (e.g.: set of configuration file with certificate Thumbprint) and we can see value in Registry which matches this.
2. Prepare installation package for upgrade of version.
3. Install new version using silent install. In silent install we would also like to modify previously set persistent value.

Code: Select all

$args= "/i TestApp.msi /quiet /qn /norestart /l*v setup-TestApp.log MY_PROP=`"ThisDoesNotWork`""
start-Process -FilePath msiexec.exe -ArgumentList $args -Wait
4. After installation value in registry remains as it was set on first installation. If we do normal installation, we can se value in UI as well it is promoted to Install Execution Stage

Code: Select all

$args= "/i TestApp.msi /qf /norestart /l*v setup-TestApp-UI.log MY_PROP=`"ThisDoesNotWork`""
start-Process -FilePath msiexec.exe -ArgumentList $args -Wait
Installation log of update (setup-TestApp.log)

Code: Select all

...
MSI (s) (58:0C) [14:50:01:312]: PROPERTY CHANGE: Modifying MY_PROP property. Its current value is 'value'. Its new value: 'ThisDoesNotWork'.
...
Action start 14:50:01: AppSearch.
MSI (s) (58:0C) [14:50:01:359]: Note: 1: 2262 2: Signature 3: -2147287038 
MSI (s) (58:0C) [14:50:01:359]: PROPERTY CHANGE: Modifying MY_PROP property. Its current value is 'ThisDoesNotWork'. Its new value: 'Wazzapa'.
MSI (s) (58:0C) [14:50:01:359]: Note: 1: 2262 2: Signature 3: -2147287038 
MSI (s) (58:0C) [14:50:01:359]: Note: 1: 1402 2: HKEY_CURRENT_USER32\Software\Adacta d.o.o.\{01BC57D4-7622-45A9-B55C-5CF8F79D2166} 3: 2 
...
Action ended 14:50:01: INSTALL. Return value 1.
Property(N): AppsShutdownOption = All
Property(N): APPDIR = C:\Program Files (x86)\Adacta d.o.o\TestAPP\
Property(N): DiskPrompt = [1]
Property(N): MY_PROP = Wazzapa
Property(N): PROMPTROLLBACKCOST = P
...
Environment:
- Advanced Installer 12.8
- OS of machine generating package: Windows Server 2012 R2
- OS of machine testing package: Windows Server 2012 R2

Attaching log and sample project file.

Any help would be greatly appreciated!
Attachments
Your Application.aip
(15.16 KiB) Downloaded 397 times
setup-TestApp.log
(250.35 KiB) Downloaded 336 times
Eusebiu
Posts: 4931
Joined: Wed Nov 14, 2012 2:04 pm

Re: Unattended Installation – How to Set Public Properties

Hi and welcome to Advanced Installer forums.

I tested your project and the "MY_PROP" property remains as it was set on first installation even if the package is updates with Full UI from command line, which is the normal behavior. This happens because a search for the previous value of that property is performed and the new value set through command line is overwritten with the value from the registry.

If you want to overwrite its old value, you can create a "Set installer property" custom action after the "Searches" action group from the "Custom Actions" page.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
simonr
Posts: 2
Joined: Fri Feb 03, 2017 3:36 pm

Re: Unattended Installation – How to Set Public Properties

Hello Eusebiu,

Thank you for your time and response. I was hoping that public properties passed by CLI would not be overridden by registry values. I expected that values in registry would be ignored (or even overridden) when passing parameters.

Thank you for great hint with modifying “Installation Execution Stage” with custom actions. This should do the trick. It still beats our current workaround (deletes entries from registry).

Best Regards,
Eusebiu
Posts: 4931
Joined: Wed Nov 14, 2012 2:04 pm

Re: Unattended Installation – How to Set Public Properties

You're welcome. Glad to help.

Just let me know if you have other questions.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mgorga
Posts: 45
Joined: Fri Jun 03, 2011 1:00 pm

Re: Unattended Installation – How to Set Public Properties

Hello,
I have the same scenario. I am using one property MY_PROP, that it is persistent. If I install using command line and I pass for example MY_PROP=1, on "search" phase, I lose the value of MY_PROP because it gets the value from registry. So if I add a "set property" action after searches, I have no idea of the original value passed from command line.

One workaround it is to have 2 properties, MY_PROP and MY_PROP_COPY. So I make:
1. Before search, I add Set Property Action to copy MY_PROP to MY_PROP_COPY
2. After search, I add Set Property Action to copy MY_PROP_COPY to MY_PROP to restore the original value. I use a conditional so this step only executes if MY_PROP_COPY has value (MY_PROP_COPY<>""), with this, if no parameter is passed throw command line, it will be used the value stored on the registry.

I tested this workaround and it works. The problem is that I need 2 actions for each property. I have many installers and many properties, so I will need quite a lot of job to make the changes. Is there a better option?

Best regards,
Mario
Catalin
Posts: 6597
Joined: Wed Jun 13, 2018 7:49 am

Re: Unattended Installation – How to Set Public Properties

Hello Mario,

Unfortunately, I am afraid that I am not aware of any other workaround than the one you have presented above. Basically, in every setup, you will first set the property value (from the CLI) and then it will be overwritten by the search result.

The only way would be to store the value of the property that is passed through command line into another property before the search takes place.

Please let me know if there is anything else I could help you with and I will gladly assist.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”