Forum Discussion
Get-EXOMailboxFolderStatistics result limit 1000 items
But it looks to me you might probably mean Get-MailboxFolderStatistics/Get-ExOMailboxFolderStatistics instead? Same here though, no -ResultSize parameter. In any case, if the built-in cmdlets are not returning the full set of folders, you'd probably need some EWS or Graph API based solution.
- Motly-2000May 18, 2022Copper ContributorThank you for the reply, yes I'm an idiot, yes the folder stats is what I meant, big difference.
Updated the post.
Difficult scenario to test without a mailbox with over 1000 top level or nested folders.
I'm hoping I missed something obvious but all tests of both Get-MailboxFolderStatistics/Get-ExOMailboxFolderStatistics, now limit at 1000.
Thanks again.- Network23Jun 07, 2022Copper Contributor
Motly-2000 VasilMichev TonyRedmond
Hi,
Good news, I opened a case last week from O365 support, and it seems they just added the resultsize parameter to the Get-MailboxFolderStatistics. The following command :(Get-MailboxFolderStatistics -Identity $TargetMailbox -resultsize unlimited).Counton our big big mailbox is now returning more than 1000 results.
Thanks for your assistance.
- SatnazOct 11, 2024Copper ContributorThis worked, Thank you.
I used the below script to count sub folders on my biiiig mailbox.
$Mailbox = Get-Mailbox -Identity "email address removed for privacy reasons"
$Folders = $Mailbox |
Get-MailboxFolderStatistics -ResultSize Unlimited | # Ensure all folders are retrieved
Where-Object { $_.FolderPath -notmatch '^\$' } | # Exclude the root folder
Measure-Object |
Select-Object -ExpandProperty Count
$Result = New-Object -TypeName PSCustomObject -Property @{
Username = $Mailbox.Alias
FolderCount = $Folders
}
$Result |
Select-Object -Property Username, FolderCount
- Network23May 30, 2022Copper Contributor
Motly-2000 I was able to reproduce the issue, since I do have a mailbox with approx 2000 folders. The command
Get-MailboxFolderStatistics -Identity $TargetMailboxIs now returning only the 1000 first items, it is a big issue for our systems since a script to export and archive mails in subfolders of that email relies on this command, since the capped result change without any warning, we do not have time planned to implement a whole Graph API based solution right now, and we are currently stuck on archive request on a nearly full mailbox ...
- TonyRedmondMay 31, 2022MVPI agree with Vasil that you should open a support case. It might be that the developers haven't run the cmdlet against a mailbox with so many folders. In the meantime, you might find that developing a Graph-based answer isn't as complex as you think. See https://office365itpros.com/2022/05/19/mailbox-folder-statistics/ for an example.