Archived Note: Combined function in Public Distribution Group and Mailbox Forward Report
In the face of escalating insider threats, the reporting of data breaches has become paramount for safeguarding organizational integrity. The most prevalent threat originates from employees misusing their access privileges for data exfiltration, often driven by personal gain.
To address these challenges at the mailbox level, this script is designed to automate the generation of a report on configured forwarding SMTP addresses for user or shared mailboxes.
For further reporting capabilities, refer to the Public Distribution List reporting feature, which allows security professionals to retrieve reports of all Distribution Lists open to external senders, enabling them to send mail to both internal and external recipients.
- Download or make copy of script here
- Take note of the script’s path
- Open PowerShell as an administrator
- Use
Set-ExecutionPolicy -ExecutionPolicy <VALUE> -Scope <VALUE>to change to acceptable Execution Policy - Optional: Navigate to directory location of script using
cdcommand (Example:cd “C:\MyFolder”) - Run PowerShell Script
.\<scriptname>.ps1orC:\MyFolder\<scriptname>.ps1
-OutputPathAllows the user to specify the location of the exported CSV file.
-DomainsSpecifies the email domains to be used for filtering external members. This parameter accepts a comma-separated list of domains. If not provided, the script will end.
-onpremEXSkips the connection to Exchange Online sessions entirely for Exchange Management Shell. Use this switch if you want to use for Exchange On-Premise.
mailboxfwdreport -Domains "domain1.com,domain2.com" -OutputPath "C:\Reports"mailboxfwdreport -Domains "domain1.com,domain2.com"mailboxfwdreport -Domains "domain1.com,domain2.com" -OutputPath "C:\Reports" -onpremEX mailboxfwdreport -Domains "domain1.com,domain2.com" -onpremEXImportant Note: CSV report will show as MailboxFWDReport_yyyyMMdd_HHmmss.csv in current directory of terminal if -OutputPath not specified.
-- Exchange Online PowerShell V2 module, version 2.0.4 or later
-- Powershell 7 or later
-- Exchange Server 2013, 2016, and 2019
Install Exchange Online Powershell module
Install-Module ExchangeOnlineManagement -ForcePlease Note: This will require restart of terminal after install. Only use for first time accessing Exchange Online via Powershell on local machine.
-- Always test the script in a non-production environment first.
-- Review the script's code and understand its functionality before execution.
-- The script may require specific permissions or elevated privileges to run correctly.
-- The script's behavior may vary depending on the system configuration and environment.
Open to all collaboration 🙏🏽
Please follow best practice outlined below:
- Fork from the
mainbranch only - Once forked, make branch from
mainwith relevant topic - Make commits to improve project on branch with detailed notes
- Test, test, test and verify
- Push branch to
mainin your Github project - Test, test, test and verify
- Open pull request to
mainwith details of changes (screenshots if applicable)
Once steps complete, I will engage to discuss changes if required and evaluate readiness for merge. Cases where pull requests are closed, I will provide detailed notes on the why and provide direction for your next pull request.
How to support? Buy me coffee ☕️ via Paypal

