Gathering MX Records for Office 365 Domains
An Office 365 tenant can contain multiple domains in a verified or unverified state.
This script simply outputs the MX records for each domain that has been verified into a CSV file named after the tenant ID. The CSV file is output to the %temp% by default.
You will need to run the script inside a PowerShell session connected to Office 365.