SCRIPT: Get Storage Group Backup Status

by Bharat Suneja

Exchange 2007 Mailbox Databases expose backup-related properties using the Get-MailboxDatabase cmdlet:

Get-MailboxDatabase “My Database” -status | select *backup* | fl

What you get back:
BackupInProgress :
SnapshotLastFullBackup :
SnapshotLastIncrementalBackup :
SnapshotLastDifferentialBackup :
SnapshotLastCopyBackup :
LastFullBackup :
LastIncrementalBackup :
LastDifferentialBackup :
LastCopyBackup :

Here’s a quick shell script that dumps each Storage Group and its backup-related information. I haven’t had the time to build in any validation or test to run remotely, but you can use it on an Exchange 2007 server to get the following details:

1. Storage Group Name
2. Transaction log file path
3. Date Storage Group was created
4. Name and timestamp of the oldest transaction log file
5. Number of transaction log files in the path
6. Mailbox Databases in each Storage Group
7. For each MDB, time when full, incremental, and differential backups (Streaming or VSS) were performed
(including a warning if the first log file is still available, which basically means a Full backup has never been completed).

In the following screenshot, the First Storage Group has never been backed up, so the E**00000001.log file still exists (and its timestamp is same as the Storage Group’s creation time). The second Storage Group has just been backed up, and therefore has fewer transaction logs.

Screenshot: Output of Get-SGBackupStatus.ps1 script
Figure 1: Output of Get-SGBackupStatus.ps1 script

File: Get-SGBackupStatus.zip
Date: 9/11/2008

What needs to be added:
– Time (number of days/hours) from last backup
– Warning when last backup is older than X number of days

Using the -Status switch: Reader Wolfgang Sauer points out

If you saw this post yesterday and wondered why the *backup* fields in Get-MailboxDatabase output were showing up as blank (or $null in PowerShell-speak), even after a backup has been taken, it’s because we left out the -Status switch that’s required with Get-MailboxDatabase cmdlet to make these details show up. Thanks to reader Wolfgang Sauer from Germany for pointing out the omission.

The script and the screenshot have been updated accordingly. If you downloaded the script before today, please download the updated version.

Disclaimer:
All scripts/downloads on this site provided as-is, with no warranties, and confer no rights. Please test any scripts/downloads in a lab environment before using it in production.

{ 3 comments… read them below or add one }

Anonymous September 7, 2009 at 5:17 am

Hi Bharat,
How can i give input for this script from a text to file for list of servers.
Thanks,
Prasad

Reply

Bharat Suneja September 8, 2009 at 3:48 pm

@Anonymous/Prasad: You'd need to use import-csv to import list of servers, then use a foreach loop to get all mailbox databases for the server and feed them to the code.

Reply

Anonymous April 20, 2010 at 10:57 am

get-exchangeserver | get-mailboxdatabase -status | select storagegroup, name, lastfullbackup, lastincrementalbackup | format-table storagegroup, name, lastfullbackup, lastincrementalbackup

Reply

Cancel reply

Leave a Comment

Previous post:

Next post: