Journaling on Exchange (on-premise) is a feature that is often needed, especially for companies that have an obligation to the authorities to comply with the retention obligation.
With Exchange online this is a little more difficult. 3rd party tools should be used for this, as native journaling is not intended.
I have developed a solution for this using PowerShell. To be more precise, there are 2 scripts which can be used accordingly.
The two scripts are described below in this article and can be downloaded and used free of charge from GitHub.
As always, although I have tested and used the script several times, I cannot and will not accept any liability for the use of this script.
Readers who download the script are free to customize it according to their needs. Commercial use is allowed, but monetarization requires my explicit permission.
I hope that this solution can help you in your daily work.
Exchange Online Journaling & Reporting Suite
A comprehensive PowerShell solution for configuring Exchange Online journaling and generating automated monthly HTML reports with detailed message analytics and user insights.
Features Overview
Journaling Configuration
- Global Journaling Rules – Capture all messages
- Automatic Prerequisites – Handles undeliverable reports
- Mailbox Validation – Ensures required mailboxes exist
- Interactive Setup – Prompts for missing information
- Rule Management – Creates and updates seamlessly
Advanced Monthly Reporting
- Full Monthly Coverage – Complete calendar month reports
- Enhanced User Analysis – Detailed sender/recipient info
- Professional HTML Reports – Modern, responsive design
- Message Statistics – Comprehensive breakdowns
- Activity Metrics – Daily averages and patterns
Automation Features
- Scheduled Tasks – Automated monthly generation
- Multiple Creation Methods – XML, PowerShell, schtasks
- Error Handling – Robust error management
- Task Verification – Automatic testing
- Fallback Options – Multiple creation approaches
Quick Start
Get up and running in minutes with these essential commands:
Install-Module -Name ExchangeOnlineManagement -Force -AllowClobber# Configure journaling and generate current month report
.\Configure-ExchangeJournaling.ps1 -JournalEmailAddress “[email protected]” -UndeliverableReportsAddress “[email protected]”# Set up automated monthly reports
.\Schedule-JournalingReports.ps1 -JournalEmailAddress “[email protected]”
Detailed Script Documentation
Main Script: Configure-ExchangeJournaling.ps1
The primary script that handles both journaling configuration and report generation. This script provides comprehensive functionality for setting up Exchange Online journaling and creating detailed monthly reports.
Parameters Reference
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
JournalEmailAddress | String | Required | – | Email address where journal reports will be sent. This mailbox must exist before running the script. |
UndeliverableReportsAddress | String | Optional | – | Email address where undeliverable journal reports will be sent. Required for journaling configuration but can be provided interactively. |
ReportPath | String | Optional | C:\ExchangeReports | Directory path where HTML reports will be saved. Directory will be created if it doesn’t exist. |
MonthsBack | Integer | Optional | 1 | Number of months back to generate reports for. Each month generates a separate report file. |
UseHistoricalSearch | Switch | Optional | False | Use historical search for data older than 10 days. Slower but more comprehensive for complete monthly reports. |
SkipJournalingConfig | Switch | Optional | False | Skip journaling configuration and only generate reports. Useful for report-only executions. |
Usage Examples
Complete Setup with Journaling and Reporting
-JournalEmailAddress “[email protected]” `
-UndeliverableReportsAddress “[email protected]” `
-ReportPath “D:\Reports” `
-MonthsBack 3 `
-UseHistoricalSearch
This example configures journaling with all prerequisites and generates reports for the last 3 months using historical search for complete data.
Reports Only (Skip Journaling Configuration)
-JournalEmailAddress “[email protected]” `
-SkipJournalingConfig
Perfect for scheduled tasks or when journaling is already configured. Only generates the current month report.
Interactive Setup
The script will interactively prompt for any missing required information, such as the undeliverable reports address.
Automation Script: Schedule-JournalingReports.ps1
This script creates Windows scheduled tasks to automatically run monthly reports. It includes multiple fallback methods to ensure reliable task creation across different Windows environments.
Parameters Reference
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
JournalEmailAddress | String | Required | – | Email address for journal destination. Must match the address used in the main script. |
ReportPath | String | Optional | C:\ExchangeReports | Directory where HTML reports will be saved. Should match the path used in the main script. |
ScriptPath | String | Optional | C:\Scripts\Configure-ExchangeJournaling.ps1 | Full path to the main Configure-ExchangeJournaling.ps1 script file. |
TaskName | String | Optional | Exchange Online Monthly Report | Name for the scheduled task. Must be unique in the Windows Task Scheduler. |
Usage Examples
Basic Scheduled Task Creation
Creates a basic monthly scheduled task using default paths and settings. The task will run on the 1st of each month at 2:00 AM.
Custom Paths and Task Name
-JournalEmailAddress “[email protected]” `
-ReportPath “\\FileServer\Reports” `
-ScriptPath “\\FileServer\Scripts\Configure-ExchangeJournaling.ps1” `
-TaskName “Monthly Exchange Analytics”
Perfect for enterprise environments with centralized file storage. Uses UNC paths for network accessibility.
Advanced Configuration
Prerequisites Setup
Before running the scripts, ensure you have the following prerequisites configured:
1. Required Mailboxes
New-Mailbox -Name “Journal Mailbox” -Alias “journal” -UserPrincipalName “[email protected]”# Create undeliverable reports mailbox
New-Mailbox -Name “Undeliverable Reports” -Alias “undeliverable” -UserPrincipalName “[email protected]”
2. Required Permissions
- Exchange Administrator role for journaling configuration
- Compliance Administrator role for message trace access
- Local Administrator rights for scheduled task creation
Historical Data Access
For complete monthly reports that include data beyond the standard 10-day limit:
.\Configure-ExchangeJournaling.ps1 `
-JournalEmailAddress “[email protected]” `
-UseHistoricalSearch `
-MonthsBack 6
Custom Report Scheduling
For advanced scheduling scenarios, you can manually create custom schedules using Windows Task Scheduler:
- Open Task Scheduler (taskschd.msc)
- Create Basic Task
- Set Trigger: Monthly, 1st day, 2:00 AM
- Set Action: Start PowerShell.exe
- Configure Arguments:
Report Features
Enhanced User Analysis
The generated reports include comprehensive analysis of your organization’s email communication patterns:
Top 10 Senders Analysis
- User Information: Display name, email, title, department, office location
- Message Statistics: Total message count with inbound/outbound breakdown
- Activity Metrics: Daily averages and unique recipient counts
- External Indicators: Visual badges distinguishing external vs internal users
Top 10 Recipients Analysis
- User Information: Complete organizational details and contact information
- Communication Patterns: Detailed message distribution analysis
- Sender Diversity: Unique sender counts and communication breadth
- Activity Trends: Daily communication averages and patterns
Visual Dashboard Features
Six Key Metrics
- Total Messages
- Inbound/Outbound Counts
- Daily Averages
- Unique Users
Interactive Charts
- Daily Volume Bar Charts
- Message Status Distribution
- Activity Pattern Visualization
- Responsive Design
Monthly Coverage
- Complete Calendar Months: Always generates full month reports regardless of execution date
- Smart Date Handling: Automatically calculates proper date ranges for accurate reporting
- Current Month Support: Handles partial current month data intelligently
- Historical Integration: Seamless access to older data when historical search is enabled
Troubleshooting Common Issues
Journaling Configuration Failures
Solution:
- Ensure the undeliverable reports mailbox exists in your organization
- Provide the -UndeliverableReportsAddress parameter
- Run the script interactively to be prompted for the missing address
Date Range Limitations
Solution:
- Use -UseHistoricalSearch for data older than 10 days
- Accept the automatic date range adjustment for recent data
- Consider using Exchange Online admin center for comprehensive historical reports
Scheduled Task Creation Issues
Solution:
- Run PowerShell as Administrator
- The script includes multiple fallback methods automatically
- Use manual task creation instructions provided in error output
Permission Issues
Solution:
- Verify Exchange Administrator role assignment
- Ensure Compliance Administrator permissions
- Check local administrator rights for scheduled tasks
- Confirm mailbox access permissions for journal and undeliverable addresses
Best Practices
Security Recommendations
- Use dedicated service accounts for automation tasks
- Store credentials securely using Windows Credential Manager
- Implement least-privilege access principles
- Enable audit logging for compliance requirements
- Regularly review and rotate service account credentials
Performance Optimization
- Schedule reports during off-peak hours (typically 2:00-4:00 AM)
- Use historical search sparingly as it’s resource intensive
- Implement report archiving to prevent disk space issues
- Monitor Exchange Online throttling limits during execution
- Consider staggered execution for multiple tenant environments
Maintenance Guidelines
- Review and update mailbox permissions quarterly
- Archive old reports to prevent storage issues
- Test scheduled tasks monthly to ensure proper operation
- Update PowerShell modules regularly for security and features
- Document any customizations for future reference
Ready to Get Started?
Download the scripts and start automating your Exchange Online journaling and reporting today!
Result example
![]() |
![]() |
![]() |
![]() |