The Deploy OS Deployment Server baseline has a fixlet "ODBC Setup" with the following action script:
action uses wow64 redirection false
if {not exists key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\SQLExpress" of x64 registry}
if {version of operating system < "10" as version}
prefetch SQLEXPR_x64_ENU.exe sha1:e0a5a388255244f1f5eb2fbf46bdc7292f7e3d8e size:289058768 https://download.microsoft.com/download/E/F/2/EF23C21D-7860-4F05-88CE-39AA114B014B/SQLEXPR_x64_ENU.exe sha256:f857ff82145e196bf85af32eeb0193fe38302e57b30beb54e513630c60d83e0d
parameter "dbVersion" = "140"
parameter "ODBCDriver" = "ODBC Driver 13 for SQL Server"
else
prefetch SQLEXPR_x64_ENU.exe sha1:652b2388e961269e04c679f60bc8d7853bb907f3 size:279293816 https://download.microsoft.com/download/3/8/d/38de7036-2433-4207-8eae-06e247e17b25/SQLEXPR_x64_ENU.exe sha256:2e61c8bbde6021f9026c54ad9db4bbb1227e68761d4c00a6a50a2c70fe7afe05
parameter "dbVersion" = "160"
parameter "ODBCDriver" = "ODBC Driver 17 for SQL Server"
endif
waithidden __Download\SQLEXPR_x64_ENU.exe /Q /ACTION=Install /FEATURES=SQL /INSTANCENAME=SQLEXPRESS /IACCEPTSQLSERVERLICENSETERMS
continue if {exists key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\SQLExpress" of x64 registry}
endif
waithidden cmd.exe /C ""{value "ODBCToolsPath" of key ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\" & (parameter "dbVersion") & "\Tools\ClientSetup") of x64 registry}sqlcmd.exe" -S localhost\SQLEXPRESS -Q "CREATE DATABASE AutoDeploy""
runhidden cmd.exe /C odbcconf configsysdsn "{parameter "ODBCDriver"}" "DSN=AutoDeploy|SERVER=(local)\SQLEXPRESS|Database=AutoDeploy|Trusted_Connection=yes"
The issue is the dbVersion parameter is wrapped in the following statement:
if {not exists key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\SQLExpress" of x64 registry}
and therefore the relevance substitution later in the actionscript fails.
This isn't normally an issue but was for me when attempting to deploy to a computer that had previous installations of SQL Server. The uninstall baseline doesn't seem to clean this up either, at least for me. I'd recommend the parameter be defined outside that if statement.