Most of my publicly available PowerShell scripts start out by solving my own problem first, before they were cleaned up and released to the world. One of the earliest examples of this is my Get-DailyBackupAlerts.ps1 script, which checks Exchange database backup time stamps and sends an email report to alert you to any that have not recently been backed up. I can’t tell you how many times this script avoided a potential disaster in environments that I managed, and I’ve heard from dozens of other people in the Exchange community that tell me it saved their bacon as well.
Get-DailyBackupAlerts.ps1 was first developed in 2011, and it would have been developed for an Exchange 2007 environment at first. Over time I added support for Exchange 2010 and database availability groups, but after that I only did a few bug fixes and stopped updating the script in 2014 since it just kept working for new versions of Exchange without any changes needed.
This week I had some time to look at the code again. I wanted to update the script so that it handled differential backups (until now it only looked at full and incremental backups), using code that I wrote for Exchange Analyzer. As it turns out, retrofitting the new code to the old script wasn’t as simple as I thought it would be. But it gave me a good excuse to tidy up a bunch of other things that were symptoms of having written the script over five years ago, as well as add a few enhancements that were suggested on GitHub.
And so I am pleased to release V1.07 of Get-DailyBackupAlerts.ps1, which includes:
- Handling for differential backups
- Color-coded status in report (alert/OK)
- Change to calculation of hours since last backup to base it on UTC time, which is more accurate for multi-region environments