none
Export Users mailbox size from exchange online into csv file? RRS feed

  • Question

  • i know its something i used to do with my on-prem exchange, poer mailbox DB.

    is there a powershell command to export all users mailbox size to a csv file?

    Monday, July 15, 2019 8:00 PM

Answers

  • Please go to Office 365 central admin->Usage Report to change mailbox to get the mailbox size/user seat and export them to a csv file also.

    This is really a good report for mailbox statistics, you could click 'Export' to export the data to a CSV file.

    Or you could use the following script, it exports the data to a csv file named mailboxstas.csv in the Desktop.

    $Maiboxes = Get-Mailbox | ? {$_.RecipientTypeDetails -eq "UserMailbox"}
    $Result1 = @()
    foreach ($Maibox in $Maiboxes) {
    $a = Get-MailboxStatistics $Maibox.Alias | select TotalItemSize,Displayname
    $b = Get-MailboxFolderStatistics $Maibox.Alias | ? {$_.Name -eq "Recoverable Items"} | select @{Expression={};Label="Name";}, @{Expression={};Label="MailboxSize";}, @{Expression={$_.FolderAndSubfolderSize};Label="RecoverableItemsSize";}
    $b.Mailboxsize= $a.TotalItemSize
    $b.Name =  $a.Displayname
    $Result1 += $b
    
    }
    $Result1 | Export-Csv C:\Users\Administrator\Desktop\mailboxstas.csv -NoTypeInformation


    Regards,

    Manu Meng


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Tuesday, July 16, 2019 10:15 AM
    Moderator

All replies

  • sorry, forgot the part where i am would like to have the "recoverableitems" size reported per user as well
    Monday, July 15, 2019 8:08 PM
  • Please go to Office 365 central admin->Usage Report to change mailbox to get the mailbox size/user seat and export them to a csv file also.
    • Edited by Byron1115 Tuesday, July 16, 2019 3:16 AM
    Tuesday, July 16, 2019 3:16 AM
  • Please go to Office 365 central admin->Usage Report to change mailbox to get the mailbox size/user seat and export them to a csv file also.

    This is really a good report for mailbox statistics, you could click 'Export' to export the data to a CSV file.

    Or you could use the following script, it exports the data to a csv file named mailboxstas.csv in the Desktop.

    $Maiboxes = Get-Mailbox | ? {$_.RecipientTypeDetails -eq "UserMailbox"}
    $Result1 = @()
    foreach ($Maibox in $Maiboxes) {
    $a = Get-MailboxStatistics $Maibox.Alias | select TotalItemSize,Displayname
    $b = Get-MailboxFolderStatistics $Maibox.Alias | ? {$_.Name -eq "Recoverable Items"} | select @{Expression={};Label="Name";}, @{Expression={};Label="MailboxSize";}, @{Expression={$_.FolderAndSubfolderSize};Label="RecoverableItemsSize";}
    $b.Mailboxsize= $a.TotalItemSize
    $b.Name =  $a.Displayname
    $Result1 += $b
    
    }
    $Result1 | Export-Csv C:\Users\Administrator\Desktop\mailboxstas.csv -NoTypeInformation


    Regards,

    Manu Meng


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Tuesday, July 16, 2019 10:15 AM
    Moderator
  •  wasnt able to show the "recoverable items" in this csv report. is there a way to add that field?
    Thursday, July 18, 2019 12:26 PM
  •  wasnt able to show the "recoverable items" in this csv report. is there a way to add that field?

    The recoverable items size is not included in the Usage Report. You could also try to use the scripts I shared above.

    Put it in a Note Pad and save as a ps1 file, then open Windows Powershell, connect to Exchange Online Powershell and run the scripts, a report will be generated then and recoverable items size is right there.

    Regards,

    Manu Meng


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Friday, July 19, 2019 2:04 AM
    Moderator
  • Just checking in to see if above information was helpful. Please let us know if you would like further assistance.

    Regards, 

    Manu Meng


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Monday, July 22, 2019 10:21 AM
    Moderator
  • is there a way to make this show "all users"?? its currently only reporting 1000, and i have around 12k mailboxes i need reports on
    Monday, July 22, 2019 2:12 PM
  • is there a way to make this show "all users"?? its currently only reporting 1000, and i have around 12k mailboxes i need reports on

    Yes, we can set -ResultSize to be "unlimited" in the first line and keep the other lines unchanged.

    $Maiboxes = Get-Mailbox -ResultSize unlimited | ? {$_.RecipientTypeDetails -eq "UserMailbox"}

    ...

    Regards,

    Manu Meng


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Tuesday, July 23, 2019 10:01 AM
    Moderator
  • thanks, i did that yesterday. report took nearly 24 hours to complete, but i finally got all the data i need!

    Tuesday, July 23, 2019 11:46 AM
  • thanks, i did that yesterday. report took nearly 24 hours to complete, but i finally got all the data i need!

    Thanks for your feedback!

    If you don't mind, we'd suggest you mark the replies above as answers, so it will be easy for other community members to find the useful one/ones.

    Regards,

    Manu Meng


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Wednesday, July 24, 2019 1:54 AM
    Moderator