In this blog post, I will show you how to find newly created mailboxes in Exchange Online using PowerShell.
Connect to Exchange Online
Before you start you will need to install and connect to Exchange Online using the following steps.
Install the new Exchange Online V2 PowerShell module by running the cmdlet on your Windows 10 or Windows Server OS.
Install-Module -Name ExchangeOnlineManagement
After completing the installation, connect to Exchange Online with the below cmdlet.
Connect-ExchangeOnline
Code
To find newly created mailboxes that have been created in the last 14 days and export them to a CSV file run the following code.
Get-Mailbox -resultsize unlimited | where-object {$_.WhenMailboxCreated -gt (get-date).adddays(-14)} | ` Select-Object @{N='Emailaddress'; E={$_.UserPrincipalName}} | export-csv newmailboxes.csv -NoTypeInformation