< Back
Set-DbaAvailabilityGroup
Post
NAME Set-DbaAvailabilityGroup
SYNOPSIS
Sets availability group properties on a SQL Server instance.
SYNTAX
Set-DbaAvailabilityGroup [[-SqlInstance] <Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>]
[[-SqlCredential] <Pscredential>] [[-AvailabilityGroup] <System.String[]>] [-AllAvailabilityGroups <Switch>]
[-DtcSupportEnabled <Switch>] [[-ClusterType] <String>] [[-AutomatedBackupPreference] <String>]
[[-FailureConditionLevel] <String>] [[-HealthCheckTimeout] <Int>] [-BasicAvailabilityGroup <Switch>]
[-DatabaseHealthTrigger <Switch>] [-IsDistributedAvailabilityGroup <Switch>] [[-InputObject]
<Microsoft.SqlServer.Management.Smo.AvailabilityGroup[]>] [-EnableException <Switch>] [<CommonParameters>]
DESCRIPTION
Sets availability group properties on a SQL Server instance.
PARAMETERS
-AllAvailabilityGroups [<Switch>]
Set properties for all availability group on an instance.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-AutomatedBackupPreference [<String>]
Specifies how replicas in the primary role are treated in the evaluation to pick the desired replica to
perform a backup.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-AvailabilityGroup [<System.String[]>]
Only set specific availability group properties.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-BasicAvailabilityGroup [<Switch>]
Indicates whether the availability group is basic. Basic availability groups like pumpkin spice and uggs.
https://docs.microsoft.com/en-us/sql/da ... roups-alwa
ys-on-availability-groups
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-ClusterType [<String>]
Cluster type of the Availability Group. Only supported in SQL Server 2017 and above.
Options include: External, Wsfc or None.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-DatabaseHealthTrigger [<Switch>]
Indicates whether the availability group triggers the database health.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-DtcSupportEnabled [<Switch>]
Enables DtcSupport.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-EnableException [<Switch>]
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.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-FailureConditionLevel [<String>]
Specifies the different conditions that can trigger an automatic failover in Availability Group.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-HealthCheckTimeout [<Int>]
This setting used to specify the length of time, in milliseconds, that the SQL Server resource DLL should wait
for information returned by the sp_server_diagnostics stored procedure before reporting the Always On Failover
Cluster Instance (FCI) as unresponsive.
Changes that are made to the timeout settings are effective immediately and do not require a restart of the
SQL Server resource.
Defaults is 30000 (30 seconds).
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-InputObject [<Microsoft.SqlServer.Management.Smo.AvailabilityGroup[]>]
Enables piping from Get-DbaAvailabilityGroup.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-IsDistributedAvailabilityGroup [<Switch>]
Indicates whether the availability group is distributed.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-SqlCredential [<Pscredential>]
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.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-SqlInstance [<Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>]
The target SQL Server instance or instances. Server version must be SQL Server version 2012 or higher.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
NOTES
Tags: AvailabilityGroup, HA, AG
Author: Chrissy LeMaire (@cl), netnerds.net
Website: https://dbatools.io
Copyright: (c) 2018 by dbatools, licensed under MIT
License: MIT https://opensource.org/licenses/MIT
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Get-DbaAvailabilityGroup -SqlInstance sql2016 | Set-DbaAvailabilityGroup -DtcSupportEnabled
Enables DTC for all availability groups on sql2016
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Get-DbaAvailabilityGroup -SqlInstance sql2016 -AvailabilityGroup AG1 | Set-DbaAvailabilityGroup
-DtcSupportEnabled:$false
Disables DTC support for the availability group AG1
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Set-DbaAvailabilityGroup -SqlInstance sql2016 -AvailabilityGroup AG1 -DtcSupportEnabled:$false
Disables DTC support for the availability group AG1
RELATED LINKS
https://dbatools.io/Set-DbaAvailabilityGroup
SYNOPSIS
Sets availability group properties on a SQL Server instance.
SYNTAX
Set-DbaAvailabilityGroup [[-SqlInstance] <Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>]
[[-SqlCredential] <Pscredential>] [[-AvailabilityGroup] <System.String[]>] [-AllAvailabilityGroups <Switch>]
[-DtcSupportEnabled <Switch>] [[-ClusterType] <String>] [[-AutomatedBackupPreference] <String>]
[[-FailureConditionLevel] <String>] [[-HealthCheckTimeout] <Int>] [-BasicAvailabilityGroup <Switch>]
[-DatabaseHealthTrigger <Switch>] [-IsDistributedAvailabilityGroup <Switch>] [[-InputObject]
<Microsoft.SqlServer.Management.Smo.AvailabilityGroup[]>] [-EnableException <Switch>] [<CommonParameters>]
DESCRIPTION
Sets availability group properties on a SQL Server instance.
PARAMETERS
-AllAvailabilityGroups [<Switch>]
Set properties for all availability group on an instance.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-AutomatedBackupPreference [<String>]
Specifies how replicas in the primary role are treated in the evaluation to pick the desired replica to
perform a backup.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-AvailabilityGroup [<System.String[]>]
Only set specific availability group properties.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-BasicAvailabilityGroup [<Switch>]
Indicates whether the availability group is basic. Basic availability groups like pumpkin spice and uggs.
https://docs.microsoft.com/en-us/sql/da ... roups-alwa
ys-on-availability-groups
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-ClusterType [<String>]
Cluster type of the Availability Group. Only supported in SQL Server 2017 and above.
Options include: External, Wsfc or None.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-DatabaseHealthTrigger [<Switch>]
Indicates whether the availability group triggers the database health.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-DtcSupportEnabled [<Switch>]
Enables DtcSupport.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-EnableException [<Switch>]
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.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-FailureConditionLevel [<String>]
Specifies the different conditions that can trigger an automatic failover in Availability Group.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-HealthCheckTimeout [<Int>]
This setting used to specify the length of time, in milliseconds, that the SQL Server resource DLL should wait
for information returned by the sp_server_diagnostics stored procedure before reporting the Always On Failover
Cluster Instance (FCI) as unresponsive.
Changes that are made to the timeout settings are effective immediately and do not require a restart of the
SQL Server resource.
Defaults is 30000 (30 seconds).
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-InputObject [<Microsoft.SqlServer.Management.Smo.AvailabilityGroup[]>]
Enables piping from Get-DbaAvailabilityGroup.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-IsDistributedAvailabilityGroup [<Switch>]
Indicates whether the availability group is distributed.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-SqlCredential [<Pscredential>]
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.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-SqlInstance [<Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>]
The target SQL Server instance or instances. Server version must be SQL Server version 2012 or higher.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
NOTES
Tags: AvailabilityGroup, HA, AG
Author: Chrissy LeMaire (@cl), netnerds.net
Website: https://dbatools.io
Copyright: (c) 2018 by dbatools, licensed under MIT
License: MIT https://opensource.org/licenses/MIT
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Get-DbaAvailabilityGroup -SqlInstance sql2016 | Set-DbaAvailabilityGroup -DtcSupportEnabled
Enables DTC for all availability groups on sql2016
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Get-DbaAvailabilityGroup -SqlInstance sql2016 -AvailabilityGroup AG1 | Set-DbaAvailabilityGroup
-DtcSupportEnabled:$false
Disables DTC support for the availability group AG1
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Set-DbaAvailabilityGroup -SqlInstance sql2016 -AvailabilityGroup AG1 -DtcSupportEnabled:$false
Disables DTC support for the availability group AG1
RELATED LINKS
https://dbatools.io/Set-DbaAvailabilityGroup