Find Large Items in Office 365 Mailboxes

Find the largest items in Office 365 mailboxes by connecting with PowerShell and running Get-MailboxFolderStatistics to export folder sizes and top subjects.

$UserCredential = Get-Credential

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/\\ -Credential $UserCredential -Authentication Basic -AllowRedirection

Import-PSSession $Session

Get-MailboxFolderStatistics -Identity [email protected] -IncludeAnalysis -FolderScope All\ | Select-Object Name,FolderPath,ItemsInFolder,FolderSize,TopSubject,TopSubjectSize,TopSubjectCount,TopSubjectPath | Out-file C:\Users\%username%\Desktop\UserMailboxResults.txt

Comments