Export-sqmDatabaseDocumentation
Configuration
sqmSQLTool v1.8.2+ · Export
✓ -WhatIf supported 🛠 Pipeline
For each database the report contains: general properties (recovery model, collation, owner, compatibility level, ReadOnly/AutoClose/AutoShrink), data and log size, last backup times (Full / Diff / Log), last DBCC CHECKDB date, VLF count (SQL Server 2016+), optional filegroup/file details, object summary (tables, views, SPs, functions, triggers, synonyms), and database users.
Backup info, CHECKDB, and VLF data are pre-loaded with a single query per instance (not per database). Output files are additionally copied to the module-configured
CentralPath via Copy-sqmToCentralPath.
Parameters
| Parameter | Type | Required | Default | Notes |
|---|---|---|---|---|
| -SqlInstance | string[] | Optional | $env:COMPUTERNAME | One or more instances. Pipeline-capable. |
| -SqlCredential | PSCredential | Optional | — | Credentials for all SQL connections. |
| -Database | string[] | Optional | @() = all user DBs | Limit to specific databases. Wildcards allowed (Sales*). |
| -IncludeSystemDatabases | switch | Switch | $false | Include master, model, msdb. tempdb is always excluded. |
| -IncludeFileDetails | bool | Optional | $true | Include filegroup/file section in the HTML report. |
| -IncludeUsers | bool | Optional | $true | Include database users section. |
| -IncludeObjectSummary | bool | Optional | $true | Include object counts (tables, views, SPs, functions, triggers, synonyms). |
| -OutputPath | string | Optional | Get-sqmDefaultOutputPath | Output directory. Created if missing. |
| -ContinueOnError | switch | Switch | $false | Continue to the next database or instance on error instead of stopping. |
| -EnableException | switch | Switch | $false | Re-throw exceptions (overrides -ContinueOnError). |
| -NoOpen | switch | Switch | $false | Do not auto-open the HTML report after creation. |
| -WhatIf / -Confirm | switch | Optional | — | ShouldProcess (ConfirmImpact: None) guards the file-write step. |
Execution Flow
Examples
Document all user databases on the local instance
Export-sqmDatabaseDocumentation
Document specific databases on SQL01 to a custom path
Export-sqmDatabaseDocumentation -SqlInstance "SQL01" -Database "SalesDB","HRApp" -OutputPath "D:\Reports"
Multiple instances via pipeline, continue on error, include system databases
"SQL01","SQL02","SQL03" | Export-sqmDatabaseDocumentation -IncludeSystemDatabases -ContinueOnError -NoOpen