geetarman wrote: ↑
Thu Mar 12, 2020 4:14 pm
In other words we need the ODBC driver to be installed and ready to use whilst we are running our installation program rather than having to be pre-installed before we run our installation program.
The way I worked around it was to add the MSODBCSQL_184.108.40.206 as a temp file then call it using the Run PowerShell Inline Script with the following parameters: -msiPath "[AI_MSODBCSQL_220.127.116.11_X64.MSI]"
# Block for declaring the script parameters.
Param($msiPath, $MSIArguments = "/i $msiPath /passive IACCEPTMSODBCSQLLICENSETERMS=YES")
Start-Process "msiexec.exe" -ArgumentList $MSIArguments -Wait -NoNewWindow
I added the custom action under Dialog Stage Paths Resolution right after CostFinalize. I also added a registry search (ODBC_DRIVER) for the ODBC driver:
Key: SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers
Name: ODBC Driver 17 for SQL Server
Type: Retrieve the raw value
Then I used it in the custom action condition so that it would only run if it was not installed: (ODBC_DRIVER <> "Installed") AND (VersionNT > 501) OR (VersionNT = 501 AND ServicePackLevel >= 2)
This way the ODBC driver will installed and ready to use before you need it in the dialog or install stage.