Checking For A Database Backup with PowerShell

#############################################################################    ################
#
# NAME: Show-LastServerBackup.ps1
# AUTHOR: Rob Sewell http://newsqldbawiththebeard.wordpress.com
# DATE:06/08/2013
#
# COMMENTS: Load function for Showing Last Backup of each database on a     server
# ————————————————————————

Function Show-LastDatabaseBackup ($SQLServer, $sqldatabase) {
    $server = new-object "Microsoft.SqlServer.Management.Smo.Server"     $SQLServer
    $db = $server.Databases[$sqldatabase]

    Write-Output "Last Full Backup"
    $LastFull = $db.lastbackupdate
    if ($lastfull -eq '01 January 0001 00:00:00')
    {$LastFull = 'NEVER'}
    Write-Output $LastFull
    Write-Output "Last Diff Backup"
    $LastDiff = $db.LastDifferentialBackupDate  
    if ($lastdiff -eq '01 January 0001 00:00:00')
    {$Lastdiff = 'NEVER'}
    Write-Output $Lastdiff
    Write-Output "Last Log     Backup"                                                  $lastLog = $db.    LastLogBackupDate 
    if ($lastlog -eq '01 January 0001 00:00:00')
    {$Lastlog = 'NEVER'}
    Write-Output $lastlog
}
Built with Hugo
Theme Stack designed by Jimmy