1. Prior to running the script you will have needed to install the Exchange Online PowerShell module. To set up your PowerShell environment I suggest you check out:
2. Connect to Exchange Online with PowerShell. For that I recommend you use my script:
That should result in you being connected to Exchange Online PowerShell as shown above.
Once you have your PowerShell environment setup, you simply run the o365-mx-check.ps1 script at the PowerShell prompt.
After checking that the Exchange Online PowerShell module is loaded and connected, the script will loop through all the mailboxes in your tenant.
For each mailbox it will check and display a number of settings as shown above including:
- Users Display name and principal name
- The primary outbound email address the mailbox uses
- When the mailbox was created
- Whether auditing is enabled for the mailbox
- What the maximum age limit of audit log entries for the mailbox
- Deleted items retention period
- If Litigation Hold is enabled
- If mailbox archiving is enabled
- The maximum message send size
- The maximum message receive size
- If POP3 is enabled for the mailbox
- If IMAP is enabled for the mailbox
Items that are not best practices will be highlighted in red for your attention as shown above.
By default, these results will only display on the screen, however if you specify the optional –CSV parameter when you run the script like:
A CSV file with the output will be created in the parent directory.
You will see the name of the CSV created at the end of the script as shown above.
Each CSV file is timestamped to ensure that a unique file will be created each time the script is run.
A log file, o365-mx-alert.txt is also created in the parent directory as well on each run.
The log file will be overwritten each time the script is run.
Thus, the o365-mx-check.ps1 script has 1 optional parameter, that can be used:
-csv = output all logs for period to a CSV file in the parent directory. A new CSV file is created for each script execution
The script will also produce a log file (o365-mx-check.txt) in the parent directory, that is overwritten on the each run of the script.
You will find this script and all my publicly available scripts at:
Don’t forget to check back there regularly for updates. Also, if you have any feedback or suggestion on this script or what you’d like to see me create, please let me know. I also maintain a large array of additional scripts via a paid subscription. More details of that can be found at www.ciaopspatron.com.