Create a Powershell CustomAction using Automation Interface

Create a Powershell CustomAction using Automation Interface

Summary

The following Powershell Script is an example of how to use Installshield's Automation Interface to create an .ism project file and then add a powershell custom action.

Resolution

# Purpose of this Powershell script: Create an ism project file and add a custom action. It may be necessary to change the value of "ISWiAuto26.ISWiProject" depending on the version of Installshield you are using.

$m_ISWiProj = new-object -comobject ISWiAuto26.ISWiProject

$strFile = "C:\Basic_MSI\Sample\Test.ism"

$m_ISWiProj.CreateProject($strFile,1)

$m_ISWiProj.CloseProject()

$m_ISWiProj.OpenProject($strFile)

$MyCusto = $m_ISWiProj.AddCustomAction("PowersehllCA")

#$MyCusto.ActionType = 1

#MyCusto.ActionType=2097152  // For Immediate Execution
$MyCusto.ActionType=2098176  # For Deferred Execution

$MyCusto.Name = "PowershellCA"

$MyCusto.SourceEx="C:\Users\Administrator\Desktop\test.ps1"

$MyCusto.Comment = "Test CA powershell"

$m_ISWiProj.SaveProject()

$m_ISWiProj.CloseProject()

 

Was this article helpful? Yes No
No ratings
Version history
Revision #:
3 of 3
Last update:
‎Apr 14, 2021 03:00 AM
Updated by:
 
Contributors