- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Let user set InstallShield property during installation, then use that property in PowerShell
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Hello everyone,
I'm trying to implement something in our installer. I'd like the user to set a certain property during the installation. (say, after the License Agreement screen) Once it is time to actually install the software, I will run a 'PowerShell Custom Action' with the 'In-Script Execution' set to 'Deferred', otherwise the PowerShell script is immediately executed.
The problem I'm running into is that the property is always empty. This is 100% caused by the 'Deferred' execution, but I really need this to work. Any ideas?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
I figured this one out. Let's assume you have a PowerShell Custom Action you want to run in deferred execution. The PowerShell Custom Action is named 'Foobar'. In order to use this in PowerShell you have to do the following:
1. Set the property in a dialog, let's assume the property is named FOOBAR_PROPERTY
2. Create a custom action by richt clicking the Custom Actions -> New Set Property
3. Name that newly added property, for example "MakePropertiesAvailableForFoobar", set the Property Name exactly the same as your PowerShell CustomAction so in this case, Foobar.
4. Now in the Property Value field you fill in the properties that were filled in from the dialog between square brackets like this: [FOOBAR_PROPERTY] (multiple properties can be added by adding a semicolon [FOOBAR_PROPERTY1];[FOOBAR_PROPERTY2]; etc)
5. Set the Sequence to Install Exec Sequence 'After LaunchConditions'.
6. Now in your PowerShell Custom Action, set In-Script Execution to 'Deferred Execution' (in my case I used In System Context)
7. Set the Sequence to Install Exec Sequence 'After PublishProduct'
8. Now in your powershell you can do the following:
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Hello @gomochainstall,
Thank you for your post.
Since your PowerShell Custom Action is running in deferred execution, you cannot directly access most Windows Installer (MSI) properties. Most MSI properties are not directly accessible during deferred execution. Instead, you need to access your MSI property via a special MSI property named CustomActionData.
Here is a link to documentation about using the CustomActionData MSI property:
Accessing or Setting Windows Installer Properties Through Deferred, Commit, and Rollback Custom Actions
https://docs.revenera.com/installshield27helplib/helplibrary/AccessingProps-DeferredCAs.htm
Please give this suggestion a try. Does this work for you?
Please let us know if you have any questions or concerns. Thanks!
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
I figured this one out. Let's assume you have a PowerShell Custom Action you want to run in deferred execution. The PowerShell Custom Action is named 'Foobar'. In order to use this in PowerShell you have to do the following:
1. Set the property in a dialog, let's assume the property is named FOOBAR_PROPERTY
2. Create a custom action by richt clicking the Custom Actions -> New Set Property
3. Name that newly added property, for example "MakePropertiesAvailableForFoobar", set the Property Name exactly the same as your PowerShell CustomAction so in this case, Foobar.
4. Now in the Property Value field you fill in the properties that were filled in from the dialog between square brackets like this: [FOOBAR_PROPERTY] (multiple properties can be added by adding a semicolon [FOOBAR_PROPERTY1];[FOOBAR_PROPERTY2]; etc)
5. Set the Sequence to Install Exec Sequence 'After LaunchConditions'.
6. Now in your PowerShell Custom Action, set In-Script Execution to 'Deferred Execution' (in my case I used In System Context)
7. Set the Sequence to Install Exec Sequence 'After PublishProduct'
8. Now in your powershell you can do the following:
![](/skins/images/8CE4FAD0DE6F3A6F9D0567434D2D2DAE/responsive_peak/images/icon_anonymous_message.png)