Execure-MSI error handling

In the installation script among other staff I’m installing an MSI like this:

Execute-MSI -Action Install -Path "$dirfiles\AmazonRedshiftODBC64-"

and getting the console log like this:

[02-01-2021 19:03:58.629] [Initialization] [Get-MsiTableProperty] :: Read data from Windows Installer database file [C:\Users\cadm_litovvi00\Downloads\TableauDesktop_2018-3-12_64b_R1.00\04_Package\Files\AmazonRedshiftODBC64-] in table [Property

[02-01-2021 19:03:58.713] [Initialization] [Get-InstalledApplication] :: Get information for installed Product Code [{788C401A-726B-4CE7-8BC2-89FD7967A6ED}]...
[02-01-2021 19:03:58.969] [Initialization] [Execute-MSI] :: Executing MSI action [Install]...
[02-01-2021 19:03:58.991] [Initialization] [Execute-Process] :: [msiexec.exe] successfully resolved to fully qualified path [C:\WINDOWS\system32\msiexec.exe].
[02-01-2021 19:03:59.006] [Initialization] [Test-IsMutexAvailable] :: Check to see if mutex [Global\_MSIExecute] is available. Wait up to [10 minute(s)] for the mutex to become available.
[02-01-2021 19:03:59.020] [Initialization] [Test-IsMutexAvailable] :: Mutex [Global\_MSIExecute] is available for an exclusive lock.
[02-01-2021 19:04:00.032] [Initialization] [Execute-Process] :: Working Directory is [C:\Users\cadm_litovvi00\Downloads\TableauDesktop_2018-3-12_64b_R1.00\04_Package\Files].
[02-01-2021 19:04:00.043] [Initialization] [Execute-Process] :: Executing [C:\WINDOWS\system32\msiexec.exe /i "C:\Users\cadm_litovvi00\Downloads\TableauDesktop_2018-3-12_64b_R1.00\04_Package\Files\AmazonRedshiftODBC64-" ALLUSERS=1 REBOOT=Really
Suppress REBOOTPROMPT=S /QB-! /L*v "C:\WINDOWS\Logs\AmazonRedshiftODBC64-"]...
[02-01-2021 19:04:00.695] [Initialization] [Get-MsiExitCodeMessage] :: Get message for exit code [1603].
[02-01-2021 19:04:00.702] [Initialization] [Execute-Process] :: Execution failed with exit code [1603].
[02-01-2021 19:04:00.709] [Initialization] [Exit-Script] :: AmazonCorporateLLC_AmazonRedshiftODBCDriver64-bit_1.3.7.1000 Installation completed with exit code [1603].
[02-01-2021 19:04:00.713] [Initialization] [Exit-Script] :: -------------------------------------------------------------------------------

How can add error handler (try-catch) for this particular error exit code? I’d like to ignore this error and keep going with the further installation. Now the scrip exist with error

Execute-MSI -Action Install -Path "$dirfiles\AmazonRedshiftODBC64-" -IgnoreExitCodes "1603"

Just make sure you’re using the latest version of the toolkit.

1 Like

Love you! That easy…