Enable-SqlAlwaysOn cmdlet used to enable AlwaysOn for a SQL Server service is failing

  • Hi there 
    I am developing some PS scripts to set up an AlwaysOn availability group. I am trying to use the Enable-SqlAlwaysOn cmdlet to enable AlwaysOn on a remote server - I get a prompt saying 'You have to restart the SQL service in order for the change to take effect. Do you want to continue?' I click Yes but then get the following failure:

    Enable-SqlAlwaysOn : ChangeHADRService failed for Service 'MSSQL$MyInstance_TEST'.
    At line:1 char:1
    + Enable-SqlAlwaysOn -Path SQLSERVER:\SQL\MyServer\MyInstance_TEST
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo    : NotSpecified: (:) [Enable-SqlAlwaysOn], FailedOperationException
      + FullyQualifiedErrorId : Microsoft.SqlServer.Management.Smo.FailedOperationException,Microsoft.SqlServer.Management.PowerShell.Hadr.EnableSqlHADRServiceCommand

    Anyone experienced this or has any thoughts?

    Thanks 🙂

  • I've discovered why I get the error: it's because the server i was testing on wasn't configured in a windows failover cluster - doh! Once the server is a participant in a cluster (a pre-req for AlwaysOn), this cmdlet works.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply