sql 2017 avalibilty group cluster failover powershell

Joseph Patrick 641 Reputation points
2020-11-20T17:45:24.797+00:00

We have SCOM 2019 using SQL 2017 in a multi subnet cluster. We are trying to design a BCP/ DR steps to manually failover the operationsDB cluster.

We want this to use PowerShell and have it as a script if possible.
The script would need to write the event to the event log and move the cluster over to the other site.

I have been looking online for references and possible scripts to do this, I have been reviewing the links below. to come up with such actions.

Any help on pointing me to an existing script, providing code logic, etc. would be appreciated, I assume other admins have done this for their environments thus why I am asking about how to script this process to work with little user action for BCP/DR actions.

https://learn.microsoft.com/en-us/sql/database-engine/availability-groups/windows/perform-a-forced-manual-failover-of-an-availability-group-sql-server?view=sql-server-ver15
http://lifeofageekadmin.com/using-powershell-move-cluster-resources-preferred-node/
http://lifeofageekadmin.com/using-powershell-failover-cluster-resources-patching/

Operations Manager
Operations Manager
A family of System Center products that provide infrastructure monitoring, help ensure the predictable performance and availability of vital applications, and offer comprehensive monitoring for datacenters and cloud, both private and public.
1,481 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,794 questions
Windows Server Clustering
Windows Server Clustering
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.Clustering: The grouping of multiple servers in a way that allows them to appear to be a single unit to client computers on a network. Clustering is a means of increasing network capacity, providing live backup in case one of the servers fails, and improving data security.
997 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,522 questions
{count} votes

Accepted answer
  1. Dirk Hondong 871 Reputation points
    2020-11-20T18:15:02.803+00:00

    Hi there,

    no complete solution.
    I am not a fan of reinventing the wheel, so maybe take a look at the dbatools cmdlets
    Especially
    http://docs.dbatools.io/#Invoke-DbaAgFailover
    That would at least help to failover your availability group(s) easily.

    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.