Export-sqmAlwaysOnConfiguration
Always On
sqmSQLTool v1.8.2+ · Export
✓ -WhatIf supported 🛠 Pipeline
Per AG, the export includes: name, backup preference, failure condition level, health-check timeout, DB-failover and distributed-AG flags, all replicas with their availability mode / failover mode /
ReadableSecondary setting / backup priority, listener DNS name, port and IP addresses, and the list of member databases.
FI-TS compliance check:
ReadableSecondary must be NO on all replicas. Any replica with READ_ONLY, ALL, or any non-NO value triggers a Write-Warning and sets Status = 'Warning' on the result object. Use -NoWarning to suppress the console warning (the status still reflects the issue).
Parameters
| Parameter | Type | Required | Default | Notes |
|---|---|---|---|---|
| -SqlInstance | string[] | Optional | $env:COMPUTERNAME | One or more instances. Pipeline-capable. Processed sequentially. |
| -SqlCredential | PSCredential | Optional | — | Used for all instance connections. |
| -OutputPath | string | Optional | C:\System\WinSrvLog\MSSQL | Output directory for TXT and CSV files. Created automatically if missing. |
| -NoWarning | switch | Switch | $false | Suppress Write-Warning for FI-TS violations. Status property still reflects the issue. |
| -NoOpen | switch | Switch | $false | Do not auto-open the TXT report after creation. |
| -EnableException | switch | Switch | $false | Re-throw errors instead of recording them in the result object. |
| -WhatIf / -Confirm | switch | Optional | — | ShouldProcess (ConfirmImpact: None) guards file-write step. -WhatIf skips TXT/CSV creation. |
Execution Flow
Examples
Export AG configuration from SQL01 (warns if ReadableSecondary != NO)
Export-sqmAlwaysOnConfiguration -SqlInstance "SQL01"
Export to a custom path, suppress FI-TS warnings, do not open the report
Export-sqmAlwaysOnConfiguration -SqlInstance "SQL01" -OutputPath "D:\Reports" -NoWarning -NoOpen
Pipeline: export configuration from multiple instances
"SQL01","SQL02","SQL03" | Export-sqmAlwaysOnConfiguration -NoOpen