Compare-DbaAgReplicaOperator
View SourceSynopsis
Compares SQL Agent Operators across Availability Group replicas to identify configuration differences.
Description
Compares SQL Agent Operators across all replicas in an Availability Group to identify differences in operator configurations. This helps ensure consistency across AG replicas and detect when operators have been created or removed on one replica but not others.
This is particularly useful for verifying that junior DBAs have applied alert notification changes to all replicas or for troubleshooting issues where operator configurations have drifted between replicas.
Compares operator names and their email addresses to detect configuration drift.
Syntax
Compare-DbaAgReplicaOperator
[[-SqlInstance] <DbaInstanceParameter[]>]
[[-SqlCredential] <PSCredential>]
[[-AvailabilityGroup] <String[]>]
[-EnableException]
[<CommonParameters>]
Examples
Example: 1
PS C:\> Compare-DbaAgReplicaOperator -SqlInstance sql2016 -AvailabilityGroup AG1
Compares all SQL Agent Operators across replicas in the AG1 Availability Group.
Example: 2
PS C:\> Get-DbaAvailabilityGroup -SqlInstance sql2016 | Compare-DbaAgReplicaOperator
Compares SQL Agent Operators for all Availability Groups on sql2016 via pipeline input.
Optional Parameters
-SqlInstance
The target SQL Server instance or instances. Can be any replica in the Availability Group.
| Property | Value |
|---|---|
| Alias | |
| Required | False |
| Pipeline | true (ByValue) |
| Default Value |
-SqlCredential
Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.
For MFA support, please use Connect-DbaInstance.
| Property | Value |
|---|---|
| Alias | |
| Required | False |
| Pipeline | false |
| Default Value |
-AvailabilityGroup
Specifies one or more Availability Group names to compare operators across their replicas.
| Property | Value |
|---|---|
| Alias | |
| Required | False |
| Pipeline | false |
| Default Value |
-EnableException
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with “sea of red” exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this “nice by default” feature off and enables you to catch exceptions with your own try/catch.
| Property | Value |
|---|---|
| Alias | |
| Required | False |
| Pipeline | false |
| Default Value | False |
dbatools