This script can be used to export a report of all the forward/redirect rules present in all user mailboxes.
Download Link
https://github.com/junecastillote/Export-ExoMailForwardRulesRequirements
- Must have an Office 365 account that is assigned at least an Exchange Administrator role whose credentials will be used to connect to Office 365 PowerShell.
- It is important that the account is not MFA enabled as the script operates by paging and re-authenticates to Office 365 page.
- Must have a mailbox to be able to send the email report using Office 365 SMTP Relay. This could be the Service Account you’re using for the session, or a Shared Mailbox that the Service Account has Send As permission to. If you do not plan to send the report thru email, then you can disregard this requirement.
How to use
Setup Office 365 Credentials
- Open PowerShell and change to the directory where the script is saved (eg. C:\Scripts\Export-ExoMailForwardRules)
- Run this command: Get-Credential | Export-CliXml Office365StoredCredential.xml
- This saves the encrypted credential in the same folder
Modify Variables
Email Settings
NOTE: The $sender value must be the actual email address of the service account or the shared mailbox used for sending the email report.
Paging
In cases where there are a large number of mailboxes to be processed, the Exchange Online PowerShell session may timeout/disconnect which would cause the script to fail. As a workaround, this script is configured to process the mailboxes in pages. By default, the page settings is set to 100 – which means after every 100 mailboxes processed, the script will re-establish and re-authenticate the PowerShell session. You can increase the page value but it is not recommended to set it too high.Run the script
The script requires no parameters.Output
CSV FileThe csv file gets saved in the “\Reports” folder
No comments:
Post a Comment