Tuesday, September 20, 2022

Microsoft 365 Discovery Report

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 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.

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.

Click Below to access the PowerShell Script

Microsoft 365 Discovery Report – The Cloud Geezer

To get this script download for free, subscribe to my YouTube channel and then drop me an email to mark@thecloudgeezer.com and I will send you a coupon code.


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.

Mark Rochester
Mark Rochesterhttps://thecloudgeezer.com
Mark currently works in the cloud space assisting large companies to migrate from either on premises to the cloud, or cloud to cloud. His experience with Enterprise migrations spans more than 25 years which basically makes him old. However, with all the oldness creeping up he still finds technology massively exciting. Please reach out for a chat anytime you would like. :-)

Related Articles

Active Directory (AD) HTML Report

This report creates a very nice looking HTML report that can be used directly to report to clients with not much editing. Run on...

Active Directory Report (ADRecon)

This report runs on any locally connected machine and creates a beautiful report on the Active Driectory structure that it finds, as you can...

Azure AD Cloud Sync

Since the dawn of time and the creation of Office 365 we used DirSync, and then transitioned into Azure AD Connect. This has worked...

Stay Connected

- Advertisement -

Latest Articles