Forum Discussion
Roger Roger
May 09, 2018Iron Contributor
RecoverableItems
I want to export csv for all users in office 365 with their dumpster size above 50GB. Plz correct me with the below syntax Get-Mailbox -ResultSize Unlimited | Foreach{Get-MailboxFolderStatistics $_...
VasilMichev
May 09, 2018MVP
"Identity" is not a good property to use when pipeing cmdlets, try this instead:
Get-Mailbox -ResultSize Unlimited | Foreach { Get-MailboxFolderStatistics $_.PrimarySmtpAddress.ToString() -FolderScope RecoverableItems | Select Identity,@{n="Size";e={[double]((($_.FolderAndSubfolderSize.ToString()).split(" "))[2]).trimstart("(")/1GB}}} | ? {$_.Size -ge 5}
Also note that I've updated the comparison in the where clause, the size returned is a string, not a number, so you cannot compare it to 50GB.