I'm running into an issue with a custom dialog in Advanced Installer (Enterprise edition). The dialog allows the user to select an XML file. Once the file is selected, a PowerShell custom action is triggered to read and parse values from the file. The parsing itself works—I’ve confirmed this by displaying the parsed values in a message box for debugging.
However, I haven’t been able to update the two Edit Text fields on the same dialog with the parsed values. Despite trying to set the properties via Set-Property in the script, the fields remain unchanged in the UI.
Is there a specific step I’m missing to make sure the dialog updates properly with the new property values? For reference, the PowerShell script is being executed after the user selects the XML file.
Thanks in advance for any help!
Screenshot Of Dialog: https://app.screencast.com/N3tuy3H7Zw7Id
Code: Select all
#Requires -version 6
Param(
[string]$XmlPath
)
# Let's see which Powershell we're using. Feel free to remove this function
Function ReadXML() {
# Powershell Core (pwsh.exe) is used when Requires -version is greater or equal to 6
# By default, Windows PowerShell (powershell.exe) will be used. Let's see what we're using now...
if (-Not (Test-Path $XmlPath)) {
Write-Host "XML_PATH=" # No-op to avoid MSI error
exit 1
}
[xml]$xml = Get-Content $XmlPath
$dbAddress = $xml.ConnectionSettings.DatabaseConnection.ComputerName
$dbUser = $xml.ConnectionSettings.DatabaseConnection.User
# Advanced Installer captures these Write-Host outputs as property assignments
AI_SetMsiProperty DB_ADDRESS $dbAddress
AI_SetMsiProperty DB_USER $dbUser
Set-Property -Name "DB_ADDRESS" -Value $dbAddress
Set-Property -Name "DB_USER" -Value $dbUser
# When testing or debugging your script, you can quickly display a message box
[System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms')
[System.Windows.Forms.MessageBox]::Show("DB Address: $dbAddress`nDB User: $dbUser")
}
# Your code goes here
ReadXML