cancel
Showing results for 
Search instead for 
Did you mean: 

Powershell: Monitoring Exchange Journal Mailboxes

AKL
Level 6
Certified

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.

4 REPLIES 4

AKL
Level 6
Certified

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

JesusWept3
Level 6
Partner Accredited Certified
Add this as an article and some screenshots and you will get more points for it :) Good job!!
https://www.linkedin.com/in/alex-allen-turl-07370146

John_Santana
Level 6

Hi, @AKL

Thanks for the script.

Somehow it does not work for Exchange Server 2013 ?

Would you be able to update it, please?

Only Database Name, Server and Database File column are populated.

arnoldmathias
Level 4

Great script. This script assumes that each database has only one journaling mailbox. Have modified it accordingly to update for multiple mailboxes on different rows.