Commands / Test-sqmDriverInstalled
Driver Install/Uninstall

Test-sqmDriverInstalled

Checks whether a JDBC, ODBC, or DB2 driver is installed, using detection logic tailored to how each driver type actually gets installed: ODBC via Get-OdbcDriver + registry, JDBC by scanning for mssql-jdbc*.jar files, DB2 via registry / ODBC driver list / db2cli.exe presence. Read-only.

Module: sqmSQLTool
Requires: None
ShouldProcess: No
Output: PSCustomObject

Execution Flow

START -DriverType ODBC Get-OdbcDriver, match name (default: highest "ODBC Driver N for SQL Server") JDBC Search Program Files, jdbc, tomcat/lib, Apache*/lib for mssql-jdbc*.jar; version parsed from filename DB2 1. Registry HKLM:\...\IBM\DB2 2. else ODBC driver "IBM DB2*" 3. else db2cli.exe on disk (first match wins) Match found? Status = NotFound Status = Found Installed=true, resolve Version + Path Return PSCustomObject (Status, Version, Path, Message) DONE
Detection is entirely read-only and safe to run repeatedly — it never touches the system. Its natural counterpart is Install-sqmOdbcDriver / Install-sqmJdbcDriver / Install-sqmDb2Driver for installing, and the matching Uninstall-sqm*Driver commands for removal.

Parameters

ParameterTypeRequiredDescription
-DriverTypeStringRequiredWhich driver family to check: JDBC, ODBC, or DB2.
-DriverNameStringOptionalSpecific driver name to match, e.g. "ODBC Driver 18 for SQL Server". Without it, sensible defaults are used per type (highest version / mssql-jdbc*.jar / any IBM DB2 match).

Return Value

Returns a single PSCustomObject with: DriverType, DriverName, Installed (bool), Version, Path, Status (Found, NotFound, or Error), Message.

Examples

Example 1 — Check for any Microsoft SQL Server ODBC driver

Test-sqmDriverInstalled -DriverType ODBC

Example 2 — Check for a specific ODBC driver version

Test-sqmDriverInstalled -DriverType ODBC -DriverName 'ODBC Driver 18 for SQL Server'

Example 3 — Check for the JDBC driver

Test-sqmDriverInstalled -DriverType JDBC

Example 4 — Check for the DB2 client/driver

Test-sqmDriverInstalled -DriverType DB2