Get-sqmFileGrowthHistory
Diagnostics & HealthsqmSQLTool v1.8.2+ · GetTXT/CSV/HTML Export ✅ -WhatIf supported
Get-sqmAutoGrowthReport as the data source for the current size and AutoGrowth configuration of every data/log file, then appends each run's sizes to a per-instance JSON snapshot history (same approach as Get-sqmDiskSpaceReport). A linear least-squares regression over the last -HistoryDays days yields MB/day growth per file and, for files with a bounded MaxSize, an estimated number of days until MaxSize is reached. At least -MinDataPoints runs are needed before a forecast is produced - until then a file is reported as "collecting" rather than a silent n/a. Needs a recurring schedule (e.g. a daily Agent job) to accumulate snapshots; a single run establishes the baseline only.Parameters
| Parameter | Type | Required | Default | Notes |
|---|---|---|---|---|
| -SqlInstance | string[] | Optional | $env:COMPUTERNAME | One or more instances. Pipeline-capable. |
| -SqlCredential | PSCredential | Optional | , | Credentials for the connection. |
| -Database | string[] | Optional | , | Restrict to specific databases. |
| -IncludeSystem | switch | Switch | $false | Include system databases. |
| -HistoryDays | int | Optional | 30 | Look-back window (in days) of the snapshot history used for the regression. |
| -OutputPath | string | Optional | Get-sqmDefaultOutputPath\FileGrowthReports | Output directory for the TXT/CSV/HTML report files. |
| -HistoryPath | string | Optional | <OutputPath>\History | Directory holding the per-instance snapshot history (FileGrowthHistory_<Instance>.json). |
| -MinDataPoints | int | Optional | 5 | Minimum number of snapshots within the window before a forecast is produced. |
| -NoHistory | switch | Switch | $false | Do not append the current run to the history (forecast still uses whatever history already exists). |
| -ContinueOnError | switch | Switch | $false | Continue on error for an instance (otherwise the error is thrown). |
| -EnableException | switch | Switch | $false | Throw exceptions immediately - overrides -ContinueOnError. |
| -NoOpen | switch | Switch | $false | Do not automatically open the generated HTML report. |
| -WhatIf / -Confirm | switch | Optional | , | Shows which files would be created without writing them - the history snapshot is not persisted under -WhatIf either. |
Execution Flow
Examples
Run once to establish the baseline (forecast fills in after a few runs)
Get-sqmFileGrowthHistory -SqlInstance "SQL01"
Shorter regression window, custom report location
Get-sqmFileGrowthHistory -SqlInstance "SQL01" -HistoryDays 14 -OutputPath "D:\Reports"
Scheduled daily run (SQL Agent job step) - typical way to build up history
Get-sqmFileGrowthHistory -SqlInstance "SQL01" -NoOpen -ContinueOnError