PowerShell script to report last successful full backup of Exchange 2007

This script is a port of my original backup report that was written in VBScript.  That script reports on both 2003 and 2007 servers, but lacked some of the features that I wanted to put in.  PowerShell natively supports date-awareness, which makes it much easier to add the number one feature I wanted to add: highlighting servers that haven’t had backups since a specified period of time.

Because I am using the native Exchange cmdlets instead of WMI or CDOEXM, this only reports on Exchange 2007 servers.  I figure accommodating both is more work than it is worth, so I just modified my VBScript version to not include any server in the Exchange 12 admin group and I have both run every day until my migration to 2007 is complete.

The script reports the last successful full backup of any Exchange 2007 server with the mailbox role installed.  It checks for the presence of storage groups and databases within them.  It notes if a backup is currently in progress, as well as if a backup has never completed.  If a backup has not completed in the last 72 hours (modifiable), it is highlighted in red so it is easy to spot.  If a backup is less than the defined number of hours old, I use the Marlett font to display a green checkmark.  This allows for a checkmark without having to reference an external image or embed one.  Lastly, the report is emailed.  The script is shown below, but you can also just download it.

7 thoughts on “PowerShell script to report last successful full backup of Exchange 2007

  1. Hi ..I have tried this script , but it is throwing error.Not able to send email.. Is it possible to modify the script and write the out put to a .html ( or another file) instead of sending email?

  2. Cool script, but it seems for me to report all the mailboxdatabases of each server more than once. if we have three stores with one database in each, it list the multiple store under all the databases.

    S-MX-CORP01MX01
    CORP HO Storage Group
    CORP HO Mailbox Database Last Backup Started At: Monday, 11/01/2010 10:00 a
    CORP HTL Mailbox Database Last Backup Started At: Monday, 11/01/2010 10:13 a
    CORP HTL Storage Group
    CORP HO Mailbox Database Last Backup Started At: Monday, 11/01/2010 10:00 a
    CORP HTL Mailbox Database Last Backup Started At: Monday, 11/01/2010 10:13 a
    CORP Public Folder Storage Group
    CORP HO Mailbox Database Last Backup Started At: Monday, 11/01/2010 10:00 a
    CORP HTL Mailbox Database Last Backup Started At: Monday, 11/01/2010 10:13 a

  3. I got this working and it looks good but it does not seem to report on incremental bu’s?! We do fulls on the weekend and incrementals during the week.

  4. That is true. When I wrote this script, only daily fulls were being run. It is more common these days to supplement fulls with incrementals (or differentials) because of VSS. It would be easy enough for you to modify the script to simply look at LastIncrementalBackup (or SnapshotLastIncrementalBackup), but using a combination of backup types does complicate it so that it will require more than a simple modification of a line or two in the script. There are several ways I can see to report on what you want: Factor the day of the to determine which backup type to report on; report on both types of backups all the time, using the current day of the way to determine which backup type should be flagged if over X hours old; or perhaps the LastCopyBackup property will make it easier. I couldn’t find what data is reported in that property, though, to know if it will help. I thought maybe it would report the last backup, regardless of the type, but I have a feeling that isn’t what it is. I can’t look at my work installation because we don’t do backups in Exchange 2010, instead using multiple copies in a DAG and the use of a lag copy. While searching for some of this data, I came across several scripts for reporting backups of all the types. I don’t know if they include logic for flagging backups that haven’t occurred in a timeframe, or if that is why you downloaded my version in the first place. If you need further assistance with specifics of modifying my version of the script, let me know.

Leave a Reply

Your email address will not be published. Required fields are marked *

*