If you are working with a Microsoft 365 tenant, whether it is for your own or for a client, it is often necessary to obtain a decent report of what is there. You may want to know about all the Mailboxes that are in Exchange Online, Delegate information, Licenses, a full listing of Microsoft Teams with members, channel permissions and data sizes, OneDrive sizes/usage, Distribution Lists, Contacts, Guest Accounts and SharePoint sites/data/usage. Lastly it also collects MFA details, showing who has it enforced, who has registered for MFA and the type of authentication (App/Txt/Call) that they selected, and the last logon date/time.
Getting all that information can involve a load of different scripts and console items to view which is why I have put it all together into a single script. The script runs across the tenant and creates multiple CSV files with all the data, then it compiles everything into a single Excel sheet with multiple tabs, all formatted and looking nice.
Update 23 February 2023 – V4.50
Updated to version V4.50 which now adds the ability to use the spreadsheet that is created as a Migration Run Sheet much better than before. The script can add PowerShell code to the Mailbox report that will allow you to copy/paste into the PowerShell ISE to create these items in a target tenant. Supply the target UPN suffix and it will provision the code to create those identities as ANY of these options
- Mail Contacts
- Mail Users
- Mail Users with Exchange GUID and Legacy Exchange DN set – Perfect to MRS matching
- Mailbox Users – Complete M365 identities ready to be licensed and accept incoming migration data
This is a significate update in the lifecycle of this tool and with these options will aid the migration efforts of many Microsoft 365 Tenant to Tenant scenarios for admins.
The video below shows a full run through of the new version and what it is capable of
Update 29 December 2022
Updated version to 4.44. Now includes a Teams Channel report showing the granular membership of all channels, private/standard/shared, with the respective members and owners. Also fixed an error whereby EXO-Mailbox returns ‘0’ mailboxes due to ‘Alias’ error in script.
Finding the M365 Discovery Tool – Click here to be taken to the download page.
https://store.thecloudgeezer.com/products/microsoft-365-discovery-script
The Output & Tool
Here is an example of the output you can expect.





The script checks for all the modules that are required and prompts to install them if they are not present. There is no need to connect to M365 before running as it allows you to enter the credentials and make the connection at runtime./
Everything is run from a simple menu to make it easy to get the output you need.
After running, the C:\Scripts directory will look something like this.


Important Notes
I do have some important notes and comments about things that you should take a look at before you dive in.
- The script is designed to run in the C:\Scripts directory on your machine. Use line #19 if you want to change it
- In the menu, before you run it, use option #1 to enter the credentials, then option #2 to enter the tenant prefix. If you want to, you can use lines #34 – #39 to hardcode the credentials. This is useful if you want to keep running it for different things and don’t want to have to keep typing in credentials.

- On line #15 I have suppressed the status bar. This is because some of the reports that come out of Teams generate a progress bar in the PS Cmdlet it calls, meaning sometimes you can get overlays of 6-7 progress bars which is just simply annoying. Up to you if you want to use this option.
- The spreadsheet is only created when using the ‘Z’ option which runs ALL the reports sequentially.
If it is taking too long in your tenant and you want to scope the users in the mailbox reports then use lines #371 and #382 in place of the ‘get’ calls earlier and specify a unique query to cull the list down a bit.
To get a 50% discount code for this script, subscribe to my YouTube channel and then drop me an email to [email protected] and I will send you a coupon code.
https://youtube.com/thecloudgeezer
Hope you find this useful, please reach out in the comments with any thoughts, comments or improvements you would like to see.
Mark – The Cloud Geezer.