Search code examples
powershellinstallationcustom-actionadvanced-installer

How to pass parameters to a Powershell script file custom action


I have a Powershell Deferred Custom Action that I want to change from In-line Script to Script From File. The problem is that the Advanced Installer GUI no longer has a "Parameters" field to let me pass MSI installer public properties into the script:

Parameters field for Inline:

enter image description here

No Parameters field for File:

enter image description here

How can I pass values into a Powershell Script File, similar to how I could for an in-line script?


Solution

  • To get a property simply include a line with the following syntax in your script:

    $propValue = AI_GetMsiProperty YOUR_PROP
    

    Where YOUR_PROP is the property name.

    To set a property simply include a line with the following syntax in your script:

    AI_SetMsiProperty YOUR_PROP <VALUE> 
    

    Where YOUR_PROP is the property and is the value assigned to it.

    For details, please check the PowerShell CA article.