≡ Menu

PowerShell Get Last Backup date/time of SQL databases

While looking for a quick way to check when a SQL database was last backed up, the immediate thing that came into my mind is this post. I trolled around the parameters and functions of  ‘Microsoft.SqlServer.Management.smo.Server’ object and developed below tiny script to list the last backup date time of databases in a SQL server.

function Get-SQLLastBackupTime {





[System.Reflection.Assembly]::LoadWithPartialName(‘Microsoft.SqlServer.SMO’) | Out-Null

$server = New-Object (‘Microsoft.SqlServer.Management.Smo.Server’) “$DBServer”

$server.databases | select Name, LastBackupDate


Hope this help …