Execution Flow
Synopsis
Searches $SourcePath for either a Microsoft self-extractor (sqljdbc*.exe) or a JAR file (mssql-jdbc*.jar). When an EXE is found it takes priority and is run silently. When only a JAR is found, it is copied to $DestinationPath (created if necessary) and version is parsed from the filename regex mssql-jdbc-(\d+\.\d+\.\d+). The -UpdateClassPath flag appends the destination directory to the system CLASSPATH machine environment variable if not already present.
No dbatools required. Requires local administrator rights. Default destination:
C:\Program Files\Microsoft JDBC Driver for SQL Server. Uses Test-sqmDriverInstalled -DriverType JDBC for both pre-check and (after EXE install) post-install verification.Syntax
Install-sqmJdbcDriver -SourcePath <String> # required [-DestinationPath <String>] # default: C:\Program Files\Microsoft JDBC Driver for SQL Server [-UpdateClassPath <Bool>] # default $false
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| -SourcePath | String | — | Required. Directory or direct path to the JDBC installer or JAR file. |
| -DestinationPath | String | C:\Program Files\Microsoft JDBC Driver for SQL Server | Target directory for the JAR file (JAR-copy path only; ignored when an EXE installer is used). |
| -UpdateClassPath | Bool | $false | When $true, appends $DestinationPath to the system CLASSPATH machine environment variable if not already present. |
Return Value
| Property | Description |
|---|---|
| Status | AlreadyInstalled — driver detected before install; Installed — successfully installed; Error — failure at any step. |
| Version | Version string parsed from JAR filename or from Test-sqmDriverInstalled after EXE install. |
| Path | Path to the installed JAR file or driver location. |
| Message | Human-readable status description. |
Examples
# Install from network share (auto-detect EXE or JAR) Install-sqmJdbcDriver -SourcePath '\\srv\Treiber\JDBC' # Install JAR and update CLASSPATH Install-sqmJdbcDriver -SourcePath 'C:\Downloads\jdbc' -UpdateClassPath $true # Custom destination path Install-sqmJdbcDriver -SourcePath '\\srv\JDBC' -DestinationPath 'D:\Drivers\JDBC'