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


Get-DbaLastBackup

This command retrieves and compares the date/time for the last known backups, as well as the creation date/time for the database.

Default output includes columns Server, Database, RecoveryModel, LastFullBackup, LastDiffBackup, LastLogBackup, SinceFull, SinceDiff, SinceLog, Status, DatabaseCreated, DaysSinceDbCreated.

Screenshots

get-dbalastbackup

Examples

To return a custom object displaying Server, Database, RecoveryModel, LastFullBackup, LastDiffBackup, LastLogBackup, SinceFull, SinceDiff, SinceLog, Status, DatabaseCreated, DaysSinceDbCreated

Get-DbaLastBackup -SqlServer sql2014

Returns a custom object with Server name, Database name, and the date the last time backups were performed

Get-DbaLastBackup -SqlServer sql2014 -Simple

To return a gridview displaying Server, Database, RecoveryModel, LastFullBackup, LastDiffBackup, LastLogBackup, SinceFull, SinceDiff, SinceLog, Status, DatabaseCreated, DaysSinceDbCreated

Get-DbaLastBackup -SqlServer sql2016 | Out-Gridview

Author

This command was created by Klaas Vandenberghe. You can find Klaas on Twitter and his blog.

Get-Help

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

Source Code

Want to see the source code? View Get-DbaLastBackup.ps1 on GitHub
 

Related commands