How to get SQL server database synchronization status (High Availability) using PowerShell?

While working in large scale environments High Availability in SQL server database is definitely must have. Today I want to show you have to get SQL server database synchronization status using SQLPS. To get access to SQL server information you need to import first dedicated PS module – Import-Module SQLPS . Please remember to specify your SQL servers and correct SQL paths: Final script:

Execution of Powershell SQL queries

In one of the project I was working for, I was asked to create general function which can help with executing Powershell SQL queries. I prepared Powershell function which as an input need SQL server, database and query which should be executed. If database is located on specific instance remember to provide it as a part of SQL server parameter in format SQLServer\Instance As a result table with filtered rows …