In search for the best way to check sql back ups, I tried SQL drive and SMO management objects. To my surprise I got different answers from both methods:
PS C:\scripts> ls SQLSERVER:\SQL\servername\default\databases | where {$_.name -eq "databasename"} | select lastbackupdate
LastBackupDate
--------------
4/09/2011 21:06:39
PS C:\scripts> $srv = New-Object "microsoft.sqlserver.management.smo.server" servername
PS C:\scripts> ($srv.databases | where {$_.name -eq "databasename"}).lastbackupdate
maandag 5 september 2011 21:06:34
I also checked the .bak files, the Agent Job History, the \\servername\d$\databases\MSSQL10_50.MSSQLSERVER\MSSQL\Log\DatabaseBackup_0x......txt log, and a SELECT from the msdb.dbo.backupset table. All of those report sep 5 as lastbackupdate.
My server is SQL Server 2008R2 Standard Edition on WINDOWS Server 2008R2 Standard.
I use Ola Hallengren's solution to take back ups, and for the 16 other db's on this server the property is equal to the SMO method.
Why is the SQL drive lastbackupdate property different for this one database?