Execution Flow
A running Windows service counts as "installed" even without a matching registry entry (rare, but happens after partial uninstalls) — the two checks are OR'd together, not AND'd. This makes the function safe to use as a pre-flight gate before install/upgrade automation:
if (-not (Test-sqmSqlInstanceInstalled).IsInstalled) { ... }.Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| -InstanceName | String | Optional | Name of the SQL instance to check. Default: MSSQLSERVER (default instance). |
Return Value
Returns a single PSCustomObject with: InstanceName, IsInstalled, Version, Edition, ServiceName, ServiceState (Running/Stopped/NotFound), Status (Installed, NotInstalled, or Error), Message.
Examples
Example 1 — Check the default instance
Test-sqmSqlInstanceInstalledExample 2 — Check a named instance
Test-sqmSqlInstanceInstalled -InstanceName 'INST01'Example 3 — Use as an install-automation gate
if ((Test-sqmSqlInstanceInstalled).IsInstalled) { Write-Host "SQL installiert" }