Invoke-sqmSetDatabaseRecoveryMode
ConfigurationsqmSQLTool v1.8.2+ · Database Config⚠ High Impact ✓ Pre-checks
Parameters
| Parameter | Type | Required | Default | Notes |
|---|---|---|---|---|
| -SqlInstance | string | Required | — | Target SQL Server instance. |
| -SqlCredential | PSCredential | Optional | — | Credentials for the connection. |
| -Database | string[] | Required | — | Target databases (name or wildcard pattern). |
| -RecoveryMode | string | Required | — | Target mode: FULL | BULK_LOGGED | SIMPLE |
| -BackupLogBefore | switch | Switch | $false | Backup transaction log before mode change (recommended for FULL→other). |
| -BackupPath | string | Optional | Default SQL backup path | Location for optional log backup files. |
| -ContinueOnError | switch | Switch | $false | Continue to next database on error. |
| -EnableException | switch | Switch | $false | Re-throw exceptions immediately. |
| -WhatIf / -Confirm | switch | Optional | — | ShouldProcess (ConfirmImpact: High) guards mode change. |
Execution Flow
Examples
Change to SIMPLE recovery (with log backup first)
Invoke-sqmSetDatabaseRecoveryMode -SqlInstance "SQL01" -Database "MyDB" -RecoveryMode "SIMPLE" -BackupLogBefore
Change multiple databases with -WhatIf
Invoke-sqmSetDatabaseRecoveryMode -SqlInstance "SQL01" -Database "Dev*" -RecoveryMode "BULK_LOGGED" -WhatIf