Forum Discussion
PaddyB
Feb 01, 2022Brass Contributor
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...
- 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.
VasilMichev
Feb 02, 2022MVP
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.
- PaddyBFeb 07, 2022Brass Contributoryou saved my day - thanks for it