dbatools is a free PowerShell module with over 300 SQL Server administration, best practice and migration commands included.

Please note that documentation and command names may be out of date while we work furiously towards 1.0


Enable-DbaAgHadr

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

Screenshots

dbatools-Enable-DbaAgHadr

Examples

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

Enable-DbaAgHadr -SqlInstance sql2016 -Force

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

Enable-DbaAgHadr -SqlInstance sql2012\dev1 -Force

Author

This command was created by Shawn Melton. You can find Shawn on Twitter and his blog.

Get-Help

From PowerShell, execute Get-Help Enable-DbaAgHadr -Detailed for more information on this function.

Source Code

Want to see the source code? View Enable-DbaAgHadr.ps1 on GitHub
 

Related commands