Share via


Microsoft Exchange Online: How to get User Mail Box Count?

Microsoft Exchange Online

Question: Hey, can we get a count of user mailboxes on the Exchange cloud?

Solution: Yes, it's possible using PowerShell.

Cool, please get the report in Microsoft Excel with Name and Alias.

Code:




#Connect to Exchange Online
 
Import-Module MSOnline
$O365Cred = Get-Credential
$O365Session = New-PSSession â€“ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell [This link is external to TechNet Wiki. It will open in a new window.] -Credential $O365Cred -Authentication Basic -AllowRedirection
Import-PSSession $O365Session
Connect-MsolService â€“Credential $O365Cred
 
#Exchange Online User Mail Box Reporting
 
Get-Mailbox -ResultSize Unlimited | Where {$_.RecipientTypeDetails -eq 'UserMailBox'} | Select -Property Name , Alias | Export-CSV C:\Temp\XChangeOnlineReport.csv -NoTypeInformation