Processing and storing parameters in an unattended installation - Advanced Installer Community
stefan_riediger
Posts: 33
Joined: Fri Feb 18, 2022 4:07 pm

Processing and storing parameters in an unattended installation

Dear Advanced Installer Team,

Situation
In our setup we read an config xml file, which we have added by the import XML command to the Files and Folders table.
The Xml file contains an element RestAddress which looks like

Code: Select all

<setting name="RestAddress">
    <value>http://+:11003</value>
</setting>
The RestAddress is assigned to a public variable [REST_ADDRESS]
The RestAddress is parsed in a Custom Action and the port number (the number behind the last colon) is stored in [REST_PORT] public property.
A hidden edit field is used for the port number property.
The [REST_PORT] is then used in the Windows Firewall page to set an inbound rule.
That works perfect in a normal Installation setup where the UI Wizard Dialogs are shown.

Problem
When doing an unattended setup. The extraction of the port, or better the saving in the property AI_SetMsiProperty does not work.

My current knowledge
The following bullet points reflect my current knowledge and may be wrong. So please confirm or correct it.
  • Unattended Setup means that the setup is started with /passive which only shows a progress bar
  • /qn completely hides the UI
In unattended setup and /qn start of the installer:
  • the Wizard Dialog Stage is skipped
  • the table InstallUISequence is skipped
  • properties cannot be read or written with AI_SetMsiProperty and AI_GetMsiProperty
  • I can use the Install Execution Stage with Advanced execution scenario and the option Skip action in Install Execution Stage if executed in Dialog Stage, in order to run the Custom Action for parsing the RestAddress (where/how to store the port).
Question
How can I store the port number from the RestAddress into a variable, so that I can use it in the Firewall page.

If I would store RestAddress and RestPort as two elements inside the config, that would work, but I don't like having redundant information in the config file.

Thank you very much for any hint in advance,

Best regards,
Stefan
Catalin
Posts: 7852
Joined: Wed Jun 13, 2018 7:49 am

Re: Processing and storing parameters in an unattended installation

Hello Stefan,

Most of the information you provided is correct. Please allow me to correct what is wrong:
properties cannot be read or written with AI_SetMsiProperty and AI_GetMsiProperty
That is incorrect. Basically, the "Install Execution Stage" consists of four stages:

- Immediate --> this basically happens from right after the user presses the "Install" button up until the modification of the system starts ("Preparing" action group from the "Custom Actions" page)

- When the system is being modified (deferred) --> as its name suggets, the Deferred stage is when the system is being modified (e.g. the files are copied over, the registry entries are written, the services are created, etc.)

- rollback/commit --> this is not really the subject of this, so I'd like to skip it. If you'd like to read more about these, please refer to the following article: Windows Installer Custom Actions.

Now, what you mentioned above is partially correct, as the retrieval and setting of a Windows Installer property is only possible during the "Immediate" stage. There is an exception to this (a special property) which you can use to retrieve the value of a property during the Deferred stage. However, the setting/declaring a property is still not possible.

For more information about this, please refer to the following article: How to access installer properties from deferred custom actions

Now, your scenario is not quite clear to me. Could you please give me some more details (e.g. a screenshot on how you scheduled your custom action in the "Custom Actions" page). Or, even better, if possible, please forward me a copy of the .AIP file by email at support at advancedinstaller dot com so I can investigate its settings.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
stefan_riediger
Posts: 33
Joined: Fri Feb 18, 2022 4:07 pm

Re: Processing and storing parameters in an unattended installation

Hi Catalin,

thank you very much for the reply.
That helped a lot. Indeed that AI_SetProperty and AI_GetProperty worked as you described.
It turned out that there were some errors in our PowerShell scripts, some misunderstandings on my side and more worse I did not saw all locations where the properties were modified.
Now all is good.

I'm really glad your company has such a fantastic support :-)

best regards,
Stefan
Catalin
Posts: 7852
Joined: Wed Jun 13, 2018 7:49 am

Re: Processing and storing parameters in an unattended installation

You are always welcome, Stefan!

I am glad I could help.

And thank you very much for your kind words, it means a lot to us. :)

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

Return to “Common Problems”