Read MSI properties using inline script using AI_GetMsiProperty - Advanced Installer Community
DelaireD
Posts: 1
Joined: Fri Jul 01, 2022 6:29 pm

Read MSI properties using inline script using AI_GetMsiProperty

Hello,

I cant get my inline script to read my MSI properties, when I put the script in a powershell file and add a custom action using Run Powershell script file it work but not when using inline script. What am I doing wrong?


My powershell script:

Code: Select all

#Requires -version 3
Param()

$registryPath = "HKLM:\SOFTWARE\ABC\Settings"

# If registry key doesn't already exists, we create one
if (!(Test-Path $registryPath)) {
    New-Item -Path $registryPath -Force | Out-Null
}

# Profile
$propProfileValue = AI_GetMsiProperty PROFILE
if (![string]::IsNullOrEmpty($propProfileValue)) {
    New-ItemProperty -Path $registryPath -Name "Profile" -Value $propProfileValue -PropertyType "String" -Force | Out-Null
}
I execute as follows in powershell:

Code: Select all

msiexec /i ABCSetup.msi Profile=Test4
Thank you for your help!
Damien
Catalin
Posts: 7852
Joined: Wed Jun 13, 2018 7:49 am

Re: Read MSI properties using inline script using AI_GetMsiProperty

Hello Damien and welcome to our forums,

Please note that this is how you should pass the property:

Code: Select all

msiexec /i ABCSetup.msi PROFILE=Test4
Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”