commands

^

Disable-DbaAgHadr

Author Shawn Melton (@wsmelton), wsmelton.github.io
Availability Windows, Linux, macOS

 

Want to see the source code for this command? Check out Disable-DbaAgHadr on GitHub.
Want to see the Bill Of Health for this command? Check out Disable-DbaAgHadr.

Synopsis

Disables the Hadr service setting on the specified SQL Server.

Description

In order to build an AG a cluster has to be built and then the Hadr enabled for the SQL Server
service. This function disables that feature for the SQL Server service.

Syntax

Disable-DbaAgHadr
    [-SqlInstance] <DbaInstanceParameter[]>
    [[-Credential] <PSCredential>]
    [-Force]
    [-EnableException]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Disable-DbaAgHadr -SqlInstance sql2016

Sets Hadr service to disabled for the instance sql2016 but changes will not be applied until the next time the server restarts.

Example: 2
PS C:\> Disable-DbaAgHadr -SqlInstance sql2016 -Force

Sets Hadr service to disabled for the instance sql2016, and restart the service to apply the change.

Example: 3
PS C:\> Disable-DbaAgHadr -SqlInstance sql2012\dev1 -Force

Sets Hadr service to disabled for the instance dev1 on sq2012, and restart the service to apply the change.

Required Parameters

-SqlInstance

The target SQL Server instance or instances.

Alias
Required True
Pipeline true (ByValue)
Default Value

Optional Parameters

-Credential

Credential object used to connect to the Windows server as a different user

Alias
Required False
Pipeline false
Default Value
-Force

Will restart SQL Server and SQL Server Agent service to apply the change.

Alias
Required False
Pipeline false
Default Value False
-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.

Alias
Required False
Pipeline false
Default Value False
-WhatIf

Shows what would happen if the command were to run. No actions are actually performed.

Alias wi
Required False
Pipeline false
Default Value
-Confirm

Prompts you for confirmation before executing any changing operations within the command.

Alias cf
Required False
Pipeline false
Default Value