I have a PowerShell Inline custom action that I was using with version 16.9 and after I upgraded to 17.1.1, the install fails when it runs the custom action.
Code: Select all
$PATHS = @("HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall",
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall")
$SOFTWARE = "COMPANY BPR 2.0"
ForEach ($path in $PATHS) {
$installed = Get-ChildItem -Path $path |
ForEach { Get-ItemProperty $_.PSPath } |
Where-Object { $_.DisplayName -match $SOFTWARE } |
Select-Object -Property DisplayVersion
ForEach ($app in $installed) {
Write-Host BPR Version Is "$($app.DisplayVersion)"
}
}
AI_SetMsiProperty BPR_VERSION $app.DisplayVersion
MSI (c) (38!D0) [08:56:58:066]: Closing MSIHANDLE (352) of type 790531 for thread 17360
MSI (c) (38!D0) [08:56:58:066]: PROPERTY CHANGE: Adding POWERSHELL_EXECUTION_LOG property. Its value is 'ERROR: Cannot bind argument to parameter 'value' because it is null.'.
CustomAction PowerShellGetBPRVersion returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
MSI (c) (38:90) [08:56:58:066]: Closing MSIHANDLE (348) of type 790542 for thread 22692
Action ended 8:56:58: PowerShellGetBPRVersion. Return value 3.
MSI (c) (38:A4) [08:56:58:066]: Doing action: FatalError
This is the error I get when testing it from within AI:
Return code: 574
Script output: "ERROR: Cannot bind argument to parameter 'value' because it is null."
When I remove "AI_SetMsiProperty BPR_VERSION $app.DisplayVersion" from the PS script, its fine and the install continues on launch.
The custom action was scheduled during dialog & install execution if it wasn't run during dialog stage, right after FindRelatedProducts.
For the time being, I unchecked the "Fail installation if custom action returns an error", but I have other projects that use AI_SetMsiProperty.