Summary :
This article explains how to use a powershell custom action to access an MSI property with deferred custom action.
This information applies to the following InstallShield project types:
Basic MSI
InstallScript MSI
Solution:
1. Create Basic MSI Project
2. Create powershell script file names shell.ps1
function Show-CustomActionData
{
param ($propertyName)
$myProps = get-property -name $propertyName
$myPropArray = $myProps.split(";")
$ARPINSTALLLOCATION = $myPropArray[0]
$INSTALLDIR = $myPropArray[1]
$TEST = $myPropArray[2]
#$wshell = New-Object -ComObject Wscript.Shell
#$wshell.Popup("ARPINSTALLLOCATION: $ARPINSTALLLOCATION",0,"Property Value",0x1)
#$wshell.Popup("INSTALLDIR: $INSTALLDIR",0,"Property Value",0x1)
#$wshell.Popup("TEST: $TEST",0,"Property Value",0x1)
"Test" | Out-File -FilePath C:\Test\testtest.txt
$installdir | Out-File -FilePath C:\Test\testinstalldir.txt
$user | Out-File -FilePath C:\Test\testuser.txt
3. Create feature called Power and add the shell.ps1 file
4. Create Custom Action(POWERCAS) and select the shell.ps1 file, Deferred Execution in system context and After SetCustomActionData.
5. Create SetCustomActionData and set the below,
6. Build and Run the project.
7. The file C:\Test\testinstalldir.txt is created with the expected Value.
Related Articles
Access SUPPORTDIR from a Deferred, Rollback, or Commit Custom Action 5Number of Views Setting an MSI Property from VBScript Custom Action 5Number of Views Writing to the Log File from a Custom Action in an MSI 13Number of Views Deferred Execution Custom Action Cannot Retrieve a Property Value 8Number of Views PowerShell cmdlet get-property Used in a Custom Action 6Number of Views
Hi, I am Reva - Ask me anything.
No new updates
Thanks for the feedback!
Your feedback has been saved.Rate this response:
Add Additional feedback ( Optional )
Are you sure you want to cancel
the case creation?
Are you sure you want to cancel the case creation?
Are you sure you want to close this case
| Products | Region | Phone Numbers |
|---|---|---|
| FlexNet Operations FlexNet Embedded FlexNet Publisher FlexNet Connect FlexNet Code Insight InstallAnywhere InstallShield |
North America * |
+1 630-332-2513 (toll) +1 877-279-2853 (toll-free in North America) |
| Europe * |
+44 1925 944367 (toll) +44 800 047 8642 (toll-free in Europe) |
|
| Japan * | +81 3-4540-5335 (select option 2) | |
| Australia * |
+61 3 9895 2177 +61 1800 560 603 (toll-free in Australia) |
|
|
Usage Intelligence (formerly
Revulytics) Compliance Intelligence |
Please use the Case Portal to submit your support ticket or reach out to your Revenera contact. | |
Case id: 00001065
Activity: Status change: 2 hours ago