Hello Brian and welcome to Advanced Installer forums,
No, we do not have a sample for this, but I can help you achieve it.
First thing we want to know here is the fact that a property can have only two states:
1. it has a value => it exists
2. it does not exist
Yes, you are right, this can be achieved through a custom action. For instance, a PowerShell script that adds some content to a text file looks like this:
Code: Select all
Add-Content "path_to_your_text_file" "text_to_be_appended"
We have said discussed above about the two states that a property has. This will be helpful for our condition that will determine if the custom action will execute or not.
Let's consider the following property: MY_PROP
Property exists ==> the condition is: MY_PROP
Property does not exist ==> the condition is: NOT MY_PROP
In our case, the condition will be "MY_PROP".
The above script can be added in Advanced Installer as a
"PowerShellScriptInline" custom action.
The custom action content may look something as it follows: (added after the "#your code goes here" comment)
Code: Select all
$myProp = AI_GetMsiProperty MY_PROP
# the above line simply gets the value of MY_PROP property and stores it in the $myProp variable.
Add-Content "C:\Users\Catalin\Desktop\test.txt" "$myProp"
Under
"Execution Stage Condition" field, the condition may look something as it follows:
Code: Select all
(VersionNT > 501) OR (VersionNT = 501 AND ServicePackLevel >= 2) AND MY_PROP
Now you can run the following command:
Code: Select all
msiexec /i <path_to_msi> MY_PROP="SomeValue"
and the value of your property ("SomeValue") should be added to the text file.
Hope this helps.
Best regards,
Catalin