We do Full Backups daily but if you want to, you can add “LastIncrementalBackup”or “LastDifferentialBackup” to suit your needs.
Here is the script:
------------------------------------------------------------------------------------------------------------
#######################################
#Backup_report_vs1.ps1 #
#http://imjustanengineer.blogspot.com #
#Created by DJ 6/2/2010
#
#######################################
Add-PSSnapin Microsoft.Exchange.Management.powershell.admin;
Get-Mailboxserver | Get-MailboxDatabase -Status |FL Name,Server,lastfullbackup,backupinprogress,Mounted > c:\exch2007_backups.txt
start-sleep -s 120
$filename = “c:\exch2007_backups.txt”
$smtpServer = “your.smtpserver.com” #Enter FQDN of your SMTP server
$msg = new-object Net.Mail.MailMessage
$att = new-object Net.Mail.Attachment($filename)
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$msg.From = “BackupReportingScript@yourdomain.com” #Enter senders email address $msg.To.Add(”recipient1@yourdomain.com, recipient2@yourdomain.com,”) #Enter one or more recipient addresses
$msg.Subject = “Exchange 2007 Servers Backup Report" #Enter subject of message $msg.Body = “Attached is the Daily Exchange 2007 Servers Backup Report. Please note any servers that have not been backed up for more than a day.” $msg.Attachments.Add($att)
$smtp.Send($msg)
-----------------------------------------------------------------------------------------------------------
In the created text file on your C: drive you should output that looks like
Name : EXCH-SERVER01_SG01DB01
Server : EXCH-SERVER01
LastFullBackup : 6/7/2010 2:33:10 AM
BackupInProgress : False
Mounted : True
Please let us know if this is helpful to you.
No comments:
Post a Comment