Office 365 Mailbox Size Report with PowerShell

Keeping track of your Office 365 Mailbox sizes is important. You don’t want the mailboxes of your users to reach their send and receive quota, to prevent errors like “Mailbox size limit Exceeded”.

With the help of PowerShell, we can create an Office 365 Mailbox Size Report that gives you all the info you need.

The PowerShell script below exports the following data from user, shared, and archive mailboxes to a CSV file:

  • Display name
  • Primary Emailadres
  • Mailbox type
  • Last user action time
  • Total mailbox size
  • Deleted item size
  • Item Count
  • Deleted Item Count
  • Issue Warning Size
  • Prohibit Send Receive Quota (max mailbox size)
  • Archive size (if the user has an archive)
  • Archive Item Count
  • Archive Deleted Item Count
  • Archive warning quota
  • Archive quota
office 365 mailbox size report
Example office 365 mailbox size report export

I can just simply share the script with you, but it’s always good to understand how a script works. So we are first going to walk through the script, while I explain the different options. At the end of the article, you will find a link to the script in my Github.

How to use the Office 365 Mailbox Size Report

The Office 365 Mailbox size report script can be run with a couple of different parameters. You always need to supply your email address for the authentication with the -adminUPN parameter. Without any further parameters, the script will generate a report with:

  • Shared mailboxes
  • Archive mailboxes
  • Store the report in the script root location ( .\mailboxsizereport-sep-23-2021.csv)
.\MailboxSizeReport.ps1 -adminUPN john@contoso.com
get-mailboxstatistics powershell

Shared Mailboxes

You have a couple of options for the shared mailboxes. By default, they are included, but you can leave them out of the report or get only the shared mailboxes with the -sharedMailboxes parameter:

# Get only the shared mailboxes
.\MailboxSizeReport.ps1 -adminUPN john@contoso.com -sharedMailboxes only

# Get only the user mailboxes
.\MailboxSizeReport.ps1 -adminUPN john@contoso.com -sharedMailboxes no

# (Default) Get user and shared mailboxes
.\MailboxSizeReport.ps1 -adminUPN john@contoso.com -sharedMailboxes include

Archive Mailboxes

By default, we also gather the statistics of the archive mailboxes if the user has an archive mailbox. If you don’t want the archive mailboxes (they make the script a bit slower) then use the -archive:$false parameter:

# Don't get the archive mailboxes
.\MailboxSizeReport.ps1 -adminUPN john@contoso.com -archive:$false

CSV Export Path

You can define an output file and path with the -csvpath parameter.

# Define path for CSV file
.\MailboxSizeReport.ps1 -adminUPN john@contoso.com -csvpath c:\temp\mailboxsizereport.csv

The Mailbox Size Report Script

To get the Office 365 mailbox size we first need to connect to Exchange Online. Then we need both the mailbox properties and the mailbox statistics to create the complete report.

I have used the Exchange Online v2 Module for the script. The advantage of the new Exchange Online module is that it supports MFA and SSON. This way you only have to enter your email address and we can connect to Exchange Online without any user interaction.

To make the script easier to use on other computers I have added a check for the Exchange Online Management module and the option to install it when it’s not available. We also check for an existing Exchange Online connection to prevent multiple connections.

You can find a sample of the code here in this article.

Get Mailbox Size with PowerShell

To get the mailbox statistics we first need to gather all the mailboxes. The Get-Mailbox cmdlet in PowerShell returns all the mailbox properties, whereas the Get-MailboxStatistics returns the information about the mailbox usage.

So first we get all the mailboxes that we want for our report

Function Get-Mailboxes {
  <#
    .SYNOPSIS
        Get all the mailboxes for the report
  #>
  process {
    switch ($sharedMailboxes)
    {
      "include" {$mailboxTypes = "UserMailbox,SharedMailbox"}
      "only" {$mailboxTypes = "SharedMailbox"}
      "no" {$mailboxTypes = "UserMailbox"}
    }

    Get-EXOMailbox -ResultSize unlimited  -RecipientTypeDetails $mailboxTypes -Properties IssueWarningQuota, ProhibitSendReceiveQuota, ArchiveQuota, ArchiveWarningQuota, ArchiveDatabase | 
      select UserPrincipalName, DisplayName, PrimarySMTPAddress, RecipientType, IssueWarningQuota, ProhibitSendReceiveQuota, ArchiveQuota, ArchiveWarningQuota, ArchiveDatabase
  }
}

Based on the SharedMailboxes parameter we determine if we want to include them or not. From the Get-EXOMailbox cmdlet we need to get a couple of extra properties:

  • IssueWarningQuota
  • ProhibitSendReceiveQuota
  • ArchiveQuota
  • ArchiveWarningQuota
  • ArchiveDatabase

With the ArchiveDatabase property, we can determine if the user mail also has an archive mailbox. By using the select we only return the fields that we need in the mailbox report.

Get-MailboxStatistics in PowerShell

For each mailbox, we are going to get the mailbox statistics. Now we also want to include the archive mailbox of the users. For this, we will need to run the Get-EXOMailboxStatistics cmdlet twice. Once for the normal mailbox, and once for the archive mailbox.

Now I have noticed that the latter is a lot slower. I don’t know exactly why, but requesting the stats from the archive mailbox takes noticeably longer than the normal mailbox.

For the normal mailbox we can simply use the following cmdlet in PowerShell:

# Get mailbox size
$mailboxSize = Get-EXOMailboxStatistics-Identity $_.UserPrincipalName | Select TotalItemSize,TotalDeletedItemSize,ItemCount,DeletedItemCount,LastUserActionTime

For the archive mailbox, we first check if we want the archive mailbox and then if the ArchiveDatabase property is set:

# Get archive size if it exists and is requested
$archiveSize = 0

if ($archive.IsPresent -and ($_.ArchiveDatabase -ne $null)) {
        $result = Get-EXOMailboxStatistics -UserPrincipalName $_.UserPrincipalName -Archive | Select ItemCount,DeletedItemCount,@{Name = "TotalArchiveSize"; Expression = {$_.TotalItemSize.ToString().Split("(")[0]}}
        if ($result -ne $null) {
          $archiveSize = ConvertTo-Gb -size $result.TotalArchiveSize
        }else{
          $archiveSize = 0
        }
}  

For the mailboxes without Archive, we set the archiveSize to 0 and reset the archiveResult.

All the data is put into a PSCustomObject allowing us to easily export it later to a CSV file.

Function Get-MailboxStats {
  <#
    .SYNOPSIS
        Get the mailbox size and quota
  #>
  process {
    $mailboxes = Get-Mailboxes
    $i = 0

    $mailboxes | ForEach-Object {

      # Get mailbox size     
      $mailboxSize = Get-EXOMailboxStatistics-identity $_.UserPrincipalName | Select-Object TotalItemSize,TotalDeletedItemSize,ItemCount,DeletedItemCount,LastUserActionTime

      if ($null -ne $mailboxSize) {
      
        # Get archive size if it exists and is requested
        $archiveSize = 0
        $archiveResult = $null

        if ($archive.IsPresent -and ($null -ne $_.ArchiveDatabase)) {
          $archiveResult = Get-EXOMailboxStatistics -UserPrincipalName $_.UserPrincipalName -Archive | Select-Object ItemCount,DeletedItemCount,@{Name = "TotalArchiveSize"; Expression = {$_.TotalItemSize.ToString().Split("(")[0]}}
          if ($null -ne $archiveResult) {
            $archiveSize = ConvertTo-Gb -size $archiveResult.TotalArchiveSize
          }
        }

        write-host $mailboxSize.TotalDeletedItemSize
    
        [pscustomobject]@{
          "Display Name" = $_.DisplayName
          "Email Address" = $_.PrimarySMTPAddress
          "Mailbox Type" = $_.RecipientTypeDetails
          "Last User Action Time" = $mailboxSize.LastUserActionTime
          "Total Size (GB)" = ConvertTo-Gb -size $mailboxSize.TotalItemSize.ToString().Split("(")[0]
          "Deleted Items Size (GB)" = ConvertTo-Gb -size $mailboxSize.TotalDeletedItemSize.ToString().Split("(")[0]
          "Item Count" = $mailboxSize.ItemCount
          "Deleted Items Count" = $mailboxSize.DeletedItemCount
          "Mailbox Warning Quota (GB)" = ($_.IssueWarningQuota.ToString().Split("(")[0]).Split(" GB") | Select-Object -First 1
          "Max Mailbox Size (GB)" = ($_.ProhibitSendReceiveQuota.ToString().Split("(")[0]).Split(" GB") | Select-Object -First 1
          "Mailbox Free Space (GB)" = (($_.ProhibitSendReceiveQuota.ToString().Split("(")[0]).Split(" GB") | Select-Object -First 1) - (ConvertTo-Gb -size $mailboxSize.TotalItemSize.ToString().Split("(")[0])
          "Archive Size (GB)" = $(if($null -ne $archiveResult) {ConvertTo-Gb -size $archiveResult.TotalArchiveSize} else {'-'})
          "Archive Items Count" = $(if($null -ne $archiveResult) {$archiveResult.ItemCount} else {'-'}) 
          "Archive Mailbox Free Space (GB)*" = $(if($null -ne $archiveResult) {(ConvertTo-Gb -size $_.ArchiveQuota.ToString().Split("(")[0]) - $archiveSize} else {'-'})
          "Archive Deleted Items Count" = $(if($null -ne $archiveResult) {$archiveResult.DeletedItemCount} else {'-'})
          "Archive Warning Quota (GB)" = $(if($null -ne $archiveResult) {($_.ArchiveWarningQuota.ToString().Split("(")[0]).Split(" GB") | Select-Object -First 1} else {'-'})
          "Archive Quota (GB)" = $(if($null -ne $archiveResult) {(ConvertTo-Gb -size $_.ArchiveQuota.ToString().Split("(")[0])} else {'-'})
        }

        $currentUser = $_.DisplayName
        Write-Progress -Activity "Collecting mailbox status" -Status "Current Count: $i" -PercentComplete (($i / $mailboxes.Count) * 100) -CurrentOperation "Processing mailbox: $currentUser"
        $i++;
      }
    }
  }
}

You may have noticed that we convert all the sizes to GB. The reason for this is that the Get-MailboxStatistics returns the size in KB, MB, or GB, depending on the size. But in a report, it’s much more convenient to have a single unit.

So with the function below, we can convert all the sizes to GB and round them into two decimals:

Function ConvertTo-Gb {
  <#
    .SYNOPSIS
        Convert mailbox size to Gb for uniform reporting.
  #>
  param(
    [Parameter(
      Mandatory = $true
    )]
    [string]$size
  )
  process {
    if ($size -ne $null) {
      $value = $size.Split(" ")

      switch($value[1]) {
        "GB" {$sizeInGb = ($value[0])}
        "MB" {$sizeInGb = ($value[0] / 1024)}
        "KB" {$sizeInGb = ($value[0] / 1024 / 1024)}
        "B"  {$sizeInGb = 0}
      }

      return [Math]::Round($sizeInGb,2,[MidPointRounding]::AwayFromZero)
    }
  }
}

Download the Complete Script

You can download the complete script from my GitHub page. I recommend you test it first on a small set of mailboxes. Change the ResultSize in line 122 (Get-EXOMailboxes) from unlimited to 10 for example.

# Change this line
Get-EXOMailbox -ResultSize unlimited -RecipientTypeDetails $mailboxTypes -Properties IssueWarningQuota, ProhibitSendReceiveQuota, ArchiveQuota, ArchiveWarningQuota, ArchiveDatabase | 
      select UserPrincipalName, DisplayName, PrimarySMTPAddress, RecipientType, RecipientTypeDetails, IssueWarningQuota, ProhibitSendReceiveQuota, ArchiveQuota, ArchiveWarningQuota, ArchiveDatabase

# To 
Get-EXOMailbox -ResultSize 10 -RecipientTypeDetails $mailboxTypes -Properties IssueWarningQuota, ProhibitSendReceiveQuota, ArchiveQuota, ArchiveWarningQuota, ArchiveDatabase | 
      select UserPrincipalName, DisplayName, PrimarySMTPAddress, RecipientType, RecipientTypeDetails, IssueWarningQuota, ProhibitSendReceiveQuota, ArchiveQuota, ArchiveWarningQuota, ArchiveDatabase

Wrapping Up

To run this script easily from your PowerShell command line, you can add use an alias in your profile that points to the script. Read everything about settings up your PowerShell profile in this article or how to run PowerShell scripts in general in this article.

I hope you find this script useful. If you have any questions just drop a comment below.

You may also like one of the following PowerShell report scripts:

66 thoughts on “Office 365 Mailbox Size Report with PowerShell”

  1. Thanks a lot for sharing this script,

    I would like to include in your script what is the current archiving policy assigned to the mailbox. I tried adding it but received an error, could you please assist.

  2. Hi Ruud,

    Your script works great, thank you! Is it possible for the login window to open in Edge or Chrome instead of IE? We have lots of domains and copy/ pasting passwords and keys from the password manager takes time. If the login window opens in Edge or Chrome, the password manager can autocomplete these details and make things a lot faster.

  3. Thanks for the script it’s awesome. If possible can you give me something that i can add so it shows what 365 license each user has in their account. Thanks I appreciate it.

  4. Hi Rudy thank you very much for sharing! The script is amazing! I am wondering if it can be adapted to read the input from a csv file. I have a csv file with a list 40 UserPrincipalName, is there any way to use the script over this list?Thank you! Manu

  5. Hi Rudy, great script and does the job well with O365, is there away of getting a count of unread messages. This will help in seeing who not cleaning the boxes. Also I notice that the delete item count does not match what is actually there.

    Thanks again

  6. Greetings.
    Any idea how to include the totatal recoverable items size or HoldSize

    Below is a command to query this for a single user but would love to incorporate this into your script when targeting all users or just users with a specific email domain which is how I currently use your script. If you could add the total size for recoverable items this would be great

    Get-MailboxFolderStatistics -Identity john@domain.com -FolderScope RecoverableItems | where{$_.name -eq “Recoverable Items”} | select Identity,FolderAndSubfolderSize

  7. Hello Rudy

    I tried all – but as i got more than 1000 users – some of them giving below error – probably due to coverting to GB which in end messed up the report.

    Error as below –

    ConvertTo-Gb : Cannot process argument transformation on parameter ‘size’. Cannot convert value to type System.String.
    At C:\scripts\MailboxSizeReportAyoun.ps1:175 char:80
    + … $sentItemsSize = ConvertTo-Gb -size $sentItems.sentItemSize }
    + ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidData: (:) [ConvertTo-Gb], ParameterBindingArgumentTransformationException
    + FullyQualifiedErrorId : ParameterArgumentTransformationError,ConvertTo-Gb

    ConvertTo-Gb : Cannot process argument transformation on parameter ‘size’. Cannot convert value to type System.String.
    At C:\scripts\MailboxSizeReportAyoun.ps1:195 char:83
    + … l -ne $sentItems) {ConvertTo-Gb -size $sentItems.sentItemSize} else { …
    + ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidData: (:) [ConvertTo-Gb], ParameterBindingArgumentTransformationException
    + FullyQualifiedErrorId : ParameterArgumentTransformationError,ConvertTo-Gb

    Is their a way to run this script only to export result for certain domain ? as we got many domains.

    Thanks again

    • for the size error:


      # Get Sent Items
      $sentItems = Get-EXOMailboxFolderStatistics -Identity lazyadmin -Folderscope sentitems | Select-Object ItemsInFolderAndSubfolders,@{Name = "sentItemSize"; Expression = {$_.FolderAndSubfolderSize.ToString().Split("(")[0]}}
      if ($null -ne $sentItems) {
      $sentItemsSize = ConvertTo-Gb -size $sentItems.sentItemSize
      }

      For limitting on domain, check this article on how to use the filter in the Get-ExoMailbox cmdlet. You can add the filter in the Get-Mailboxes function.
      And then in the PSCustomTable:


      Sent Items Size (GB)" = $(if($null -ne $sentItemsSize) {$sentItemsSize} else {'-'})

  8. Thanks alot for your quick response Mate

    One last question: I ran the script which returned all the data but no CSV – Do we need to specify the CSV path as I got the code from your GITHUB.

    If yes can you guide at which line we need to do this ?

    Again Much Appreciated

    Regards
    Ayoun

      • Not sure if this is still active or not but wanted to see if there was a more direct answer for this. Im not super versed in Powershell. Where exactly do I add the path for the export?

        • You save the PowerShell script somewhere on your computer, for example in c:\temp. Then open the PowerShell and run the script like this:

          c:\temp\MailboxSizeReport.ps1 -adminUPN john@contoso.com -csvpath c:\temp\mailboxsizereport.csv
          

          The CSVPath is the location for the export.

  9. Hello Rudy

    Thats reall awesome ! Thanks for your efforts for the community – Much Appreciated 🙂

    I have a bit different requirement which i am trying to find out – would be great if you can help over.

    I also want to include the Size of Sent items folder – Can you guide how that is possible using your script ?

    Thanks
    Ayoun

    • You can add the following snippet just above the pscustomobject:


      $sentItems = Get-EXOMailboxFolderStatistics -Identity $_.UserPrincipalName -Folderscope sentitems | Select-Object ItemsInFolderAndSubfolders,@{Name = "sentItemSize"; Expression = {$_.FolderAndSubfolderSize.ToString().Split("(")[0]}}
      if ($null -ne $sentItems) {
      $sentItemsSize = ConvertTo-Gb -size $sentItems.sentItemSize
      }

      And then add it to the output with


      "Sent Items Size (GB)" = $(if($null -ne $sentItems) {ConvertTo-Gb -size $sentItems.sentItemSize} else {'-'})
      "Sent Items Count" = $(if($null -ne $sentItems) {$sentItems.ItemsInFolderAndSubfolders} else {'-'})

  10. Great script.
    Worked as expected on our setup. Took long to get through all the mailboxes, but I expected that much (2000+ mailboxes).

    I do have a question though. Would it be possible to get statistics on Recoverable Items out as well?
    I tried to loop it in, but all my attempts failed, so I am most likely missing something obvious.

  11. is it possible to get the mailbox statistics of the members in as security group?

    I can get the members in the security group but is a lot to start getting each user one by one
    I Am unable to combine the Msol command with Mailbox command

    How can you help?

    • Instead of the get-mailboxes function in the script, you can do something like:

      $mailboxes = Get-AzureAduser -filter "jobtitle eq 'intern'" | Get-EXOMailbox

      Where you replace the Get-AzureADuser with your command to get the users from the group

  12. Hello,
    Great Script.
    Searching on Internet I found out that LastUserActionTime is also present within Get-EXOMailboxStatistics commandlets but you need to request it like this.
    $mailboxSize = Get-EXOMailboxStatistics -identity $_.UserPrincipalName -Properties LastUserActionTime | Select-Object TotalItemSize,TotalDeletedItemSize,ItemCount,DeletedItemCount,LastUserActionTime

    @Rudy you should update your script and so use only use EXOV2 commandlet to improve speed.

      • Hi Rudy,
        I get this error”Get-Mailbox : Cannot bind parameter ‘RecipientTypeDetails’ to the target. Exception setting “RecipientTypeDetails”: “The following specified values aren’t supported by this cmdlet: ‘UserMailbox, SharedMailbox’. The allowed values are: ‘RoomMailbox’,
        ‘EquipmentMailbox’, ‘LegacyMailbox’, ‘LinkedMailbox’, ‘LinkedRoomMailbox’, ‘UserMailbox’, ‘DiscoveryMailbox’, ‘TeamMailbox’, ‘SharedMailbox’, ‘GroupMailbox’.”
        At line:116 char:61
        + Get-mailbox -ResultSize unlimited -RecipientTypeDetails $mailboxTypes -Prope …
        + ~~~~~~~~~~~~~
        + CategoryInfo : WriteError: (:) [Get-Mailbox], ParameterBindingException
        + FullyQualifiedErrorId : ParameterBindingFailed,Microsoft.Exchange.Management.RecipientTasks.GetMailbox”

        • Pretty strange, because these are the options that the script uses:


          "include" {$mailboxTypes = "UserMailbox,SharedMailbox"}
          "only" {$mailboxTypes = "SharedMailbox"}
          "no" {$mailboxTypes = "UserMailbox"}

  13. Hi Rudy,
    Couldnt figure out how to reply to your last msg. I tried .\MailboxSizeReport.ps1 -adminUPN myglobaladminacct@mydomain.com -sharedMailboxes only -archive:$false -csvpath C:\temp\boxsize.csv | Sort-Object “Total Size (GB)” -Descending

    in a powershell window to sort it by biggest mailbox first and didnt seem to work. Did I do this correctly? Thank you

  14. You can also modify this to get inactive mailbox statistics at the same time with a couple of changes.

    line 114

    Get-EXOMailbox -ResultSize unlimited -IncludeInactiveMailbox

    line 158

    $mailboxSize = Get-EXOMailboxStatistics -identity $_.PrimarySMTPAddress -IncludeSoftDeletedRecipients

    line 167

    $archiveResult = Get-EXOMailboxStatistics -PrimarySMTPAddress $_.PrimarySMTPAddress -Archive -IncludeSoftDeletedRecipients

  15. To get mailbox size info only for a specific group’s members, replace Get-EXOMailbox command (lines 114-115) with the following:

    $GrpMembers = Get-MsolGroupMember -GroupObjectId
    foreach ($member in $GrpMembers) {
    Get-EXOMailbox -Identity $member.EmailAddress -RecipientTypeDetails $mailboxTypes -Properties IssueWarningQuota, ProhibitSendReceiveQuota, ArchiveQuota, ArchiveWarningQuota, ArchiveDatabase |
    Select-Object UserPrincipalName, DisplayName, PrimarySMTPAddress, RecipientType, RecipientTypeDetails, IssueWarningQuota, ProhibitSendReceiveQuota, ArchiveQuota, ArchiveWarningQuota, ArchiveDatabase
    }

  16. Thanks a lot for the script, it was like a charm.

    Just one thing, the “path” attribute is -CSVpath and not -path

    Thanks for sharing

  17. Hey there Ruud. Thanks for sharing this information with the world. Per your suggestion, I changed the script to only do 10 mailboxes. However, when I run the script i get the following error. Can you point me in the right direction? Thanks….Rob

    Export-CSV : Access to the path ‘C:\WINDOWS\system32\MailboxSizeReport-Feb-02-2022.csv’ is denied.
    At F:\Allmailboxsizesreport.ps1:213 char:20
    + … ilboxStats | Export-CSV -Path $path -NoTypeInformation -Encoding UTF8
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : OpenError: (:) [Export-Csv], UnauthorizedAccessException
    + FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.ExportCsvCommand

    Get-Item : Cannot find path ‘C:\WINDOWS\system32\MailboxSizeReport-Feb-02-2022.csv’ because it does not exist.
    At F:\Allmailboxsizesreport.ps1:215 char:6
    + if ((Get-Item $path).Length -gt 0) {
    + ~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (C:\WINDOWS\syst…Feb-02-2022.csv:String) [Get-Item], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemCommand

    Failed to create report
    Close Exchange Online connection? [Y] Yes [N] No: no

  18. I am testing your script but I get this error:
    You cannot call a method on a null-valued expression.
    At C:\users\ADM_EXT_foliveira\documents\windowspowershell\MailboxSizeReportNew.ps1:176 char:29
    + … ize (GB)” = ConvertTo-Gb -size $mailboxSize.TotalItemSize.ToString(). …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    Any idea on what’s the problem?
    Thank you

  19. Hi Rudy,

    changing

    Get-MailboxStatistics -identity $_.UserPrincipalName

    To
    Get-MailboxStatistics -identity $_.guid.guid

    does not seem to work.

    MailboxSizeReport_fixed.ps1:166
    Line |
    166 | … $mailboxSize = Get-MailboxStatistics -identity $_.guid.guid | Selec …
    | ~~~~~~~~~~~~
    | Cannot bind argument to parameter ‘Identity’ because it is null.

    But changing it to
    Get-MailboxStatistics -identity $_.primarysmtpaddress

    seems to keep the script running (slower but it does not stop)

  20. Hi Ruud. Thanks a lot for your MailboxSizeReport.ps1 Script. Best one for 365 / EXO.

    Unfortunately i get the following issue with one mailbox and i am not sure how to debug it:

    “Get-MailboxStatistics: The specified mailbox “Karl.Klammer” isn’t unique”

    Any Idea how to solve this?

    Thanks again!

  21. would there be a way to get a certain type of user? ( i.e Agent vs Staff) ? we use an attribute6 reference in AD that determines that setting or maybe a group membership?

    • Sorry for the late response, missed your comment.

      But yes that is possible. You can use a filter to select mailboxes based on their attribute. You can change the Get-EXOMailbox cmdlet (line 122) to the following:


      Get-EXOMailbox -Filter {CustomAttribute6 -eq 'Staff'} -Properties IssueWarningQuota, ProhibitSendReceiveQuota, ArchiveQuota, ArchiveWarningQuota, ArchiveDatabase |
      select UserPrincipalName, DisplayName, PrimarySMTPAddress, RecipientType, RecipientTypeDetails, IssueWarningQuota, ProhibitSendReceiveQuota, ArchiveQuota, ArchiveWarningQuota, ArchiveDatabase

  22. Is there a way to reference a subset of users via a csv file? EG for a divestment of 10% of the company? collecting 1000 users not 10,000 and filtering down?

  23. would there be a way to add a Filter to only report on addresses with @abc.com?
    I work in a multi-tenant exchange and while report works well it takes about 36 hrs to run.
    any advise would be helpful .

  24. Very cool. What would your thoughts be on integrating this into an automated workflow to execute on a regular schedule followed by identification of mailboxes to target and mitigate?

  25. Question. How would I be able to get the last access date to the mailbox on there?

    This is perfect but I need the last access date. Is that possible?

    • Last logon time is a difficult one with PowerShell. The most accurate way to get it is to use Graph. You can change the Get-EXOMailboxStatistics to Get-MailboxStatistics and then add the LastUserActionTime property.

Leave a Comment

0 Shares
Tweet
Pin
Share
Share