dbatools is a free PowerShell module with over 180 SQL Server administration, best practice and migration commands included.


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