This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Knowledge Base
- :
- Use PowerShell to Create a Project and Add a PowerShell Custom Action Using the InstallShield Automa...
Subscribe
- Mark as New
- Mark as Read
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Use PowerShell to Create a Project and Add a PowerShell Custom Action Using the InstallShield Automation Interface
Use PowerShell to Create a Project and Add a PowerShell Custom Action Using the InstallShield Automation Interface
Summary
The following PowerShell script is an example of how to use InstallShield's Automation Interface to create a project .ism file and then add a PowerShell custom action.
Resolution
# Purpose of this PowerShell script: Create a project .ism 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("PowerShellCA")
#$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()
100% helpful
(1/1)
Comments
Aug 02, 2022
04:35 AM
- Mark as Read
- Mark as New
- Permalink
- Report Inappropriate Content
Aug 02, 2022
04:35 AM
Very helpful article. I have only one question: I'm currently also trying to add custom actions to my project using PowerShell, and I'm having trouble adding a script that is stored in the binary table, runs as a 64-bit script, and has the execution type "deferred in system context". I assume this is controlled by the ActionType number. Therefore, can you provide a list of the custom InstallShield action types (that also covers my use case)? That would be perfect - thanks.