Get-sqmDatabaseSpaceReport
Diagnostics & HealthsqmSQLTool v1.8.2+ · Get🔓 VIEW DATABASE STATE CSV+HTML Export
Get-sqmDiskSpaceReport (free space on the underlying Windows volume) or Get-sqmAutoGrowthReport (allocated file size and autogrowth configuration). Databases at or above -WarnThresholdPct / -CriticalThresholdPct are flagged accordingly, both in the returned objects and colour-coded in the HTML report. Pipeline-capable across multiple instances.Parameters
| Parameter | Type | Required | Default | Notes |
|---|---|---|---|---|
| -SqlInstance | string[] | Optional | $env:COMPUTERNAME | One or more instances. Pipeline-capable (ValueFromPipeline). |
| -SqlCredential | PSCredential | Optional | , | Credentials for the connection. |
| -Database | string[] | Optional | @() | Filter: only these databases (wildcards allowed). Default: all accessible. |
| -ExcludeDatabase | string[] | Optional | @() | Databases to skip (wildcards allowed). |
| -IncludeSystemDatabases | switch | Switch | $false | Also include master/model/msdb. tempdb is always included by SQL Server itself but rarely interesting here. |
| -WarnThresholdPct | int | Optional | 80 | Fill percentage (data or log) at which a database is flagged 'Warning'. Range: 1-100. |
| -CriticalThresholdPct | int | Optional | 90 | Fill percentage at which a database is flagged 'Critical'. Must be greater than -WarnThresholdPct. |
| -OutputPath | string | Optional | Get-sqmDefaultOutputPath\DatabaseSpaceReport | Directory for the CSV (file-level detail) and HTML (database summary) report. |
| -ContinueOnError | switch | Switch | $false | Continue with the next instance on error instead of aborting. |
| -EnableException | switch | Switch | $false | Throw exceptions immediately instead of returning as errors. |
| -NoOpen | switch | Switch | $false | Do not automatically open the HTML report after creation. |
Execution Flow
Examples
Check database fill level on the local instance
Get-sqmDatabaseSpaceReport -SqlInstance "SQL01"
Tighter critical threshold, list only the databases that aren't OK
Get-sqmDatabaseSpaceReport -SqlInstance "SQL01" -CriticalThresholdPct 95 |
Select-Object -ExpandProperty Databases | Where-Object Status -ne 'OK'
Check multiple instances via the pipeline, don't abort on the first failure
'SQL01','SQL02' | Get-sqmDatabaseSpaceReport -ContinueOnError