Revenera logo

Hi there, it’s me again.  This time, we’re looking at Powershell, which is mostly the same story as previous efforts with other scripting engines.

Notable differences are how the Const/Enum’s are handled, using the New-Variable scriptlet to make a read-only variable, as well as the usage of the Item function call.

ISWiComponents
This example illustrates getting a specific feature from the ISWiFeatures collection, and using it to set component properties, and then saving the project.

New-Variable -Option constant -Name rfsLocal -Value 0
New-Variable -Option constant -Name rfsSource -Value 1
New-Variable -Option constant -Name rfsOptional -Value 2

$m_ISWiProj = new-object -comobject IswiAuto17.ISWiProject

$strFile = “C:InstallShield 2011 ProjectsMY 64 bit Project.ism”

$m_ISWiProj.OpenProject($strFile)

$m_Feature = $m_ISWiProj.ISWiFeatures.Item(“MyApplication”)

foreach ($m_Component in $m_Feature.ISWiComponents)
{
$m_Component.RemoteInstallation = $rfsSource
}
$m_ISWiProj.SaveProject()
$m_ISWiProj.CloseProject()

ISWiFeatures
This example illustrates iterating through root-level features and components.

$m_ISWiProj = new-object -comobject IswiAuto17.ISWiProject

$strFile = “C:InstallShield 2011 ProjectsMY 64 bit Project.ism”

InstallShield icon

InstallShield

Create native MSIX packages, build clean installs, and build installations in the cloud with InstallShield from Revenera.

$m_ISWiProj.OpenProject($strFile)

$strProject = “”

Foreach ($m_Feature in $m_ISWiProj.ISWiFeatures)
{
$strProject = $strProject + “Feature: ” + $m_Feature.Name + “`n”
$strProject = $strProject + “Components: ”
Foreach ($m_Component in $m_Feature.ISWiComponents)
{
$strProject = $strProject + $m_Component.Name + ” ”
}
$strProject = $strProject + “`n”
}
Write-Host $strProject

$m_ISWiProj.CloseProject()