Compare-sqmConfigBaseline
Configuration
sqmSQLTool v1.9.202.0+ · Compare
sys.configurations (active value and pending changes) and the global trace flags against a baseline saved with Save-sqmConfigBaseline.
Two modes: live (
-SqlInstance is read now) and file (-ComparePath checks two baselines against each other, for example before and after a patch). The result has one row per difference (Category, Setting, SourceValue = baseline, TargetValue = compared state, Status, DriftType). No drift returns nothing and the report says so.
Drift types:
value_in_use differs, pending (RECONFIGURE) or pending (restart) when the configured value differs from the active one on only one side, missing for an option that exists on one side only, and trace flag. Security-relevant options (xp_cmdshell, Ole Automation Procedures, Ad Hoc Distributed Queries, clr enabled, clr strict security, cross db ownership chaining, scan for startup procs, external scripts enabled) are Critical, everything else Warning.
Options that exist in only one of two different major versions are not drift (a warning notes the version difference).
version high part of SQL Server, version low part of SQL Server and show advanced options are always ignored.
Parameters
| Parameter | Type | Required | Default | Notes |
|---|---|---|---|---|
| -BaselinePath | string | Required | — | Baseline JSON from Save-sqmConfigBaseline (reference). |
| -SqlInstance | string | Required | — | Live mode: instance to check. Required in live mode. |
| -SqlCredential | PSCredential | Optional | — | Optional SQL login (live mode). |
| -ComparePath | string | Required | — | File mode: second baseline to check against the first. Required in file mode. |
| -IgnoreOption | string[] | Optional | @() | Additional option names to skip, wildcards allowed. |
| -OutputPath | string | Optional | <module output path>\ConfigBaselineCompare | Folder for the TXT and HTML report. |
| -NoOpen | switch | Switch | $false | Do not open the report. |
| -NoReport | switch | Switch | $false | Return the rows only, write no report. |
| -EnableException | switch | Switch | $false | Throw instead of reporting an error and returning $null. |
Execution Flow
Examples
Check an instance against a baseline
Compare-sqmConfigBaseline -BaselinePath "D:\Baselines\ConfigBaseline_SQL01_v15_20261101_090000.json" -SqlInstance "SQL02"
Compare two baselines, for example before and after a patch
Compare-sqmConfigBaseline -BaselinePath $beforePatch -ComparePath $afterPatch -NoOpen
Skip options you expect to differ
Compare-sqmConfigBaseline -BaselinePath $b -SqlInstance "SQL02" -IgnoreOption "max server memory*","backup*"