dbatools is a free PowerShell module with over 200 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


Test-DbaLogShippingStatus

Most of the time your log shipping “just works”.
Checking your log shipping status can be done really easy with this function.

Make sure you’re connecting to the monitoring instance of your log shipping infrastructure.

The function will return the status for a database. This can be one or more messages in a comma separated list.
If everything is OK with the database than you should only see the message “All OK”.

Screenshots

dbatools-Test-DbaLogShippingStatus

Examples

Retrieves the log ship information from sql1 and displays all the information present including the status.

Test-DbaLogShippingStatus -SqlInstance sql1

Retrieves the log ship information for just the database AdventureWorks.

Test-DbaLogShippingStatus -SqlInstance sql1 -Database AdventureWorks2014

Retrieves the log ship information and only returns the information for the databases on the primary instance.

Test-DbaLogShippingStatus -SqlInstance sql1 -Primary

Retrieves the log ship information and only returns the information for the databases on the secondary instance.

Test-DbaLogShippingStatus -SqlInstance sql1 -Secondary

Retrieves the log ship information and only returns the columns SQL Instance, Database, Instance Type and Status.

Test-DbaLogShippingStatus -SqlInstance sql1 -Simple

Author

This command was created by Sander Stad. You can find Sander on Twitter and his blog.

Get-Help

From PowerShell, execute Get-Help Test-DbaLogShippingStatus -Detailed for more information on this function.

Source Code

Want to see the source code? View Test-DbaLogShippingStatus.ps1 on GitHub
 

Related commands