Hello AJ,
The main purpose of the
"Parameters" field from the
"Run PowerShell inline script" custom action is to access properties from a deferred custom action (when the
"Run PowerShell inline script" custom action has its execution time of
"When the system is being modfied (deferred)").
The predefined
"Run PowerShell inline script" was implemented before the
"Run PowerShell script file" custom action and many issues were encountered while developing the "Parameters" field functionality. However, this is more stable now, this being the reason why we already have on our TODO list to add the
"Parameters" field to the
"Run PowerShell script file" custom action as well. We did not proceed in adding it because it was not requested at all until now. But since you have requested it now, I have increased its priority and hopefully it will be implemented in a future version of Advanced Installer.
How do we pass parameters into the powershell script?
In what regards this, you can simply get and set properties from within your PowerShell script file by using one of the following lines:
Code: Select all
$someVariable = AI_GetMsiProperty YOUR_PROPERTY
or
Code: Select all
AI_SetMsiProperty YOUR_PROPERTY <some_value>
However, this only works when the custom action's execution time is
"Immediately". The main reason of this is because when setup enters the deferred stage, all the properties are set to empty strings. The exception to this rule is the special
CustomActionData property which keeps its values through all of the stages even during deferred, rollback and commit. Please have a look on our
"How to access installer properties from deferred custom actions" article for more information about this topic.
Hope this helps.
All the best,
Catalin