Commands / Uninstall-sqmDb2Driver
Driver Install/Uninstall

Uninstall-sqmDb2Driver

Removes the IBM DB2 ODBC/CLI driver. Looks it up in the Windows uninstall registry first (MSI-based → msiexec /x); if no registry entry exists, falls back to running IBM's own Setup.exe /silent /uninstall from the SQLLIB install directory.

Module: sqmSQLTool
Requires: Local Administrator
ShouldProcess: No
Output: PSCustomObject

Execution Flow

START Scan Uninstall registry for DisplayName -match 'IBM DB2' Registry entry found? NO Look for SQLLIB\setup.exe on disk setup.exe found? Status = NotFound Setup.exe /silent /uninstall (blocking) ExitCode 0 → Uninstalled, else Error YES Resolve ProductCode (key name or UninstallString) Code resolved? Error msiexec /x <code> /quiet /norestart 0/3010 → Uninstalled 1605 → NotFound, else Error Return PSCustomObject (Status, Message) DONE
Two independent removal paths exist because IBM DB2 client packages are sometimes MSI-based (registry-visible, removable via msiexec /x) and sometimes installed via IBM's own Setup.exe bootstrapper with no MSI registry trace. The function tries the registry path first since it's more reliable, and only falls back to Setup.exe /silent /uninstall when nothing is found there.

Parameters

ParameterTypeRequiredDescription
No parameters — auto-detects the installed DB2 driver.

Return Value

Returns a single PSCustomObject with: Status (Uninstalled, NotFound, or Error), Message.

Examples

Example 1 — Remove whichever DB2 driver is installed

Uninstall-sqmDb2Driver

Example 2 — Check the outcome

$r = Uninstall-sqmDb2Driver
if ($r.Status -eq 'Uninstalled') { Write-Host "DB2 driver removed" }