Forum Discussion

PaddyB's avatar
PaddyB
Brass Contributor
Feb 01, 2022
Solved

Exchange Online - Shared Mailbox Size and UPN

Hi Community   i try to create a list (and later export it to a CSV with the Size and UPN of all Sahremailboxes below 45GB Get-EXOMailbox -RecipientTypeDetails SharedMailbox -ResultSize Unlimited...
  • VasilMichev's avatar
    Feb 02, 2022

    That's because you're using a simple one-liner, and working with the output of the last cmdlet in the pipeline, effectively. Get-EXOMailboxStatistics does not have a UserPrincipalName property, thus the value you get is null. If you want to keep the oneliner format, add a calculated field:

     

    Get-ExOMailbox -RecipientTypeDetails SharedMailbox -ResultSize Unlimited | Select-Object DisplayName, @{n="TotalItemSize";e={(Get-ExOMailboxStatistics $_.UserPrincipalName).TotalItemSize}}, UserPrincipalName | Where-Object {[int64]($_.TotalItemSize.Value -replace '.+\(|bytes\)') -lt "45GB"} | Sort-Object TotalItemSize -Descending


    Or use a proper script instead.

Resources