Export-sqmServerConfiguration
Configuration
sqmSQLTool v1.8.2+ · Export
✓ Snapshot / Rollback
Captured categories:
SpConfigure (all sp_configure values with run/config/min/max), InstanceProperties (edition, version, collation, login mode, default paths, HA flags), Services (SQL Server / Agent / SSRS / SSIS state, start mode, service account), TempDb (file count, sizes, growth settings), DatabaseMail (profile names), LinkedServers. Optionally Databases overview via -IncludeDatabases.
Each category that fails is logged as a warning; the remaining categories are still captured (
Status = 'Partial' is implicit from the categories list). The outer catch converts a total connection failure to Write-Error or throw, depending on -EnableException.
Parameters
| Parameter | Type | Required | Default | Notes |
|---|---|---|---|---|
| -SqlInstance | string | Optional | $env:COMPUTERNAME | Target SQL Server instance. Not pipeline-capable. |
| -SqlCredential | PSCredential | Optional | — | Credentials for the SQL connection. |
| -OutputPath | string | Optional | $env:ProgramData\sqmSQLTool\Snapshots | Directory for the JSON file. Created if missing. |
| -Label | string | Optional | — | Descriptive label stored in JSON metadata (e.g. "before MaxMemory change"). |
| -IncludeDatabases | switch | Switch | $false | Also capture database-level overview (slower; adds a Databases category). |
| -EnableException | switch | Switch | $false | Re-throw on total failure instead of Write-Error. Per-category errors are always warnings only. |
Output
| Property | Type | Description |
|---|---|---|
| SnapshotPath | string | Full path to the saved JSON file. |
| Timestamp | string | ISO 8601 timestamp of the export. |
| ItemCount | int | Total settings captured across all categories. |
| Categories | string[] | List of successfully captured category names. |
| Status | string | 'Success' — or check Categories for omissions if a category errored. |
Execution Flow
Examples
Snapshot before a configuration change (with descriptive label)
$snap = Export-sqmServerConfiguration -SqlInstance "SQL01" -Label "before MaxMemory change" Write-Host "Snapshot: $($snap.SnapshotPath)"
Full export including database overview to a custom path
Export-sqmServerConfiguration -SqlInstance "SQL01" `
-OutputPath "C:\Backups\SQLSnapshots" `
-IncludeDatabases `
-Label "production-baseline"