Video Screencast Help

Powershell: Monitoring Exchange Journal Mailboxes

Created: 16 Jul 2012 | 2 comments
AKL's picture

Hello EV Admins

Attached is a custom powershell script written by myself to monitor health of journal mailboxes in our environment like Number of items, size of database, oldest/newest items etc.

The script generages HTML report using various parameters and sends over email to configured recipients via any SMTP server which has Anonymous authentication supported using any from address liked.

The powershell script is tied to a bat file which is configured in task scheduler to run every x number of hours accordingly.

We use journaling closely along with DA so the email reports on timely manner help us stay ahead of the game. Hence sharing. Hope it helps your environment too.

Comments 2 CommentsJump to latest comment

AKL's picture

Forgot to mention, you'll need to edit below lines to fit your environment:

 $dbs = Get-MailboxDatabase -Status -Server "EXJRNL.contoso.com"

Since we've only 1 journal server, I used direct parameter, you can hook in a txt file with list of serers and use for loop to cover multiple (like below)

 foreach ($machineName in $serverlist) 
 {
 $Mailbox = Get-Mailbox -Server $machinename -ResultSize Unlimited
 $dbs = $status | foreach-Object {Get-MailboxDatabase $_.DatabaseName -Status}
 foreach($db in $dbs)
 {

 

where $serverlist is the txt file.

Also you'll need to edit below line:

sendEmail JournalReport@contoso.com administrator@contoso.com "Contoso Exchange Journal Report" smtpserver.contoso.com $fileName

In above or sample code, JournalReport@contoso.com is FROM, administrator@contoso.com is TO, Contoso Exchange Journal Report is SUBJECT, smtpserver.contoso.com is SMTP server with anonymous authentication.

You can send to multiple recipients too by separating them using ","

admin1@contoso.com,admin2@contoso.com

Thank You

AKL

JesusWept3's picture

Add this as an article and some screenshots and you will get more points for it :)

Good job!!