Get-sqmDatabaseHealth
Database Health
sqmSQLTool v1.8.2+ · Get
✓ -WhatIf supported
Parameters
| Parameter | Type | Required | Default | Notes |
|---|---|---|---|---|
| -SqlInstance | string[] | Optional | $env:COMPUTERNAME | Pipeline-capable. Multiple instances supported. |
| -SqlCredential | PSCredential | Optional | — | |
| -MaxCheckDbAgeDays | int | Optional | 14 | CHECKDB older than this → Warning. |
| -MaxVlfCount | int | Optional | 200 | VLF count above this → Warning. |
| -HistoryDays | int | Optional | 30 | AutoGrowth evaluation window (Default Trace). |
| -ExcludeDatabase | string[] | Optional | — | Wildcards allowed. tempdb always excluded. |
| -IncludeSystemDatabases | switch | Switch | $false | Include master/model/msdb. tempdb always excluded. |
| -OutputPath | string | Optional | C:\System\WinSrvLog\MSSQL | Created automatically if it does not exist. |
| -ContinueOnError | switch | Switch | $false | Continue to next instance on error instead of throwing. |
Execution Flow
Examples
Health check — local instance, default thresholds
Get-sqmDatabaseHealth
Multiple instances including system databases
Get-sqmDatabaseHealth -SqlInstance "SQL01","SQL02" -IncludeSystemDatabases -OutputPath "D:\Reports"
Stricter CHECKDB threshold, longer AutoGrowth window
Get-sqmDatabaseHealth -SqlInstance "SQL01" -MaxCheckDbAgeDays 7 -MaxVlfCount 100 -HistoryDays 60
Pipeline — check all instances from OU
Get-sqmServersFromOU -OUPath "OU=SQL,DC=corp,DC=local" | Get-sqmDatabaseHealth -ContinueOnError