Execution Flow
Typically called after
Show-sqmBackupExcludeForm saves changes on the primary, or scheduled alongside Sync-sqmLoginsToAlwaysOn. Use -SkipAlwaysOnPropagation when the table is already replicated via AG (Distributed Transaction or manual sync). -IncludeSystemDatabases adds system databases (master, model, msdb, tempdb) to the exclusion sync.Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| -SqlInstance | String | Optional | Primary instance. Default: $env:COMPUTERNAME. |
| -SqlCredential | PSCredential | Optional | SQL authentication credential. |
| -IncludeSystemDatabases | Switch | Optional | Also sync system database exclusions (master, model, msdb, tempdb). |
| -SkipAlwaysOnPropagation | Switch | Optional | Skip AG secondary replicas (use when table is replicated via other means). |
| -EnableException | Switch | Optional | Throw terminating errors instead of logging warnings. |
| -WhatIf / -Confirm | Switch | Optional | Standard ShouldProcess support. |
Return Value
Returns a PSCustomObject[] — one entry per secondary replica — with: Primary, Secondary, RowsSynced, Status, Message.
Examples
Example 1 — Sync exclusion table to all AG secondaries
Sync-sqmBackupExcludeTable -SqlInstance "SQL01"
Example 2 — Preview without changes
Sync-sqmBackupExcludeTable -SqlInstance "SQL01" -WhatIf
Example 3 — Include system databases in sync
Sync-sqmBackupExcludeTable -SqlInstance "SQL01" -IncludeSystemDatabases