cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to access MSI property with a deferred custom action

How to access MSI property with a deferred custom action


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.

Image1.PNG

5. Create SetCustomActionData and set the below,

image2.PNG

6. Build and Run the project.

7. The file C:\Test\testinstalldir.txt is created with the expected Value.

Labels (3)
No ratings
Version history
Last update:
‎Aug 09, 2022 04:12 AM
Updated by:
Contributors