Exchange Dumpster : Checking and Purging.



Right so the dumpster is the hidden place to store messages after those messages are deleted, this is invisible to the user as well as the GUI, for this you need PowerShell.

The diagram below shows what we are talking about, the section at the bottom in blue is what we are talking about querying and if required to purge:


There is a maximum size for this "dumpster" after which the mailbox will behave weirdly for example not allowing calanders to be managed, or not being able to move messages to subfolders of the inbox, there are simple action to do and there are also not simple action that require a little more powershell to fix.

Get-Mailbox <mailbox> | Get-MailboxFolderStatistics | Select-Object Identity, {$_.FolderAndSubFolderSize.ToMb()}, ItemsInFolderAndSubFolders

This will give you a view like this, that shows you all the subfolders, so that the user cannot see and how many items are in the subfolders, notice that the "Deleted Items" for this mailbox is "0" as that is not where we need to look....

Check the space utilization 


We are interested in the bottom couple of folders, this is also part of the dumpster data as well, notice we have lots of deletion in these folders:


Then you need this command:

Get-MailboxStatistics -Identity <mailbox> | Select DisplayName,ItemCount,TotalItemSize

You will need to confirm you are not hitting the limit for the mailbox, in EXO that is 99GB, if on premises you will need to refer to your own database mailbox limits

You then need to check the deleted item size of the whole mailbox with that command:

Get-MailboxStatistics -Identity <mailbox> | select DisplayName,TotalDeletedItemSize

Optional : If you have archiving enabled you will need to run this as well:

Get-MailboxStatistics -Identity <mailbox> -Archive | select DisplayName,TotalDeletedItemSize

You now need to get the dumpster space :

Get-MailboxFolderStatistics -Identity <mailbox> -FolderScope RecoverableItems | Select Identity,ItemsInFolder,FolderAndSubfolderSize

Optional : If you have archiving enabled you will need to run this as well:

Get-MailboxFolderStatistics -Identity <mailbox> -Archive -FolderScope RecoverableItems | Select Identity,ItemsInFolder,FolderAndSubfolderSize

This will return something like this and you will see where the space is being used in the dumpster as below:

Identity                                          ItemsInFolder FolderAndSubfolderSize
--------                                          ------------- ----------------------
oversized@bears.local\Recoverable Items             0 41.49 GB (44,553,447,576 bytes)
oversized@bears.local\Audits                    92080 741.4 MB (777,383,734 bytes)
oversized@bears.local\Calendar Logging              0 0 B (0 bytes)
oversized@bears.local\Deletions                 68817 23.81 GB (25,570,328,273 bytes)
oversized@bears.local\DiscoveryHolds                0 0 B (0 bytes)
oversized@bears.local\Purges                    47003 16.92 GB (18,168,838,344 bytes)
oversized@bears.local\SubstrateHolds                0 0 B (0 bytes)
oversized@bears.local\Versions                      8 35.19 MB (36,897,225 bytes) 

You now need to get some statistics about that mailbox to figure out your options with this command:

Get-Mailbox -Identity <mailbox> | Format-List DisplayName,Name,IsInactiveMailbox,LitigationHoldEnabled,LitigationHoldDuration,InPlaceHolds,RetentionHoldEnabled,RetentionPolicy
That will return this:

DisplayName            : Oversized
Name                   : Oversized
IsInactiveMailbox      : False
LitigationHoldEnabled  : True
LitigationHoldDuration : Unlimited
InPlaceHolds           : {}
RetentionHoldEnabled   : False
RetentionPolicy        : 

Right as you can see here, we have Litigation Hold enabled, which can cause issues when he dumpster fills up as mail cannot be "deleted" from the mailbox its needs to be held until this is removed, however if the dumpster fills up the mailbox can be unmanageable.

Disable Litigation Hold

If you have the option to disable Litigation Hold you can do so with this command:

Set-Mailbox –Identity <mailbox> -LitigationHoldEnabled $false
Optional : Set Retention Policy

However once done you still need to clear the mailbox down, if this is something that needs to be managed you can set a retention policy on the mailbox, notice this mailbox does not have one, that the "RetentionPolicy" tag from above, to set one for a single mailbox this is the command:

Note : Replace the <Policy Name> with the name of your policy, which can be obtained with the command Get-RetentionPolicy

Set-Mailbox –RetentionPolicy <Policy name>
However if you wish to assign this to all mailboxes you can use this command instead:

$UserMailboxes = Get-Mailbox -Filter {(RecipientTypeDetails -eq 'UserMailbox')}
$UserMailboxes | Set-Mailbox –RetentionPolicy <Policy name>
If you are running commands from a blog, without understanding what they do, then you will need this command after you realised that the last command applied that policy to all mailboxes 😭

$UserMailboxes = Get-Mailbox -Filter {(RecipientTypeDetails -eq 'UserMailbox')}
$UserMailboxes | Set-Mailbox –RetentionPolicy $Null
Once you have set the retention policy that will automatically start processing later in the day, however to force then use this command:

 Start-ManagedFolderAssistant <mailbox> -FullCrawl
Enable Archiving

Another way to get space back to is enable archiving if you have a license in EXO or the space on Exchange and you have an archive database setup, if you enable the archive then the dumpster can utilise that as well which means your mailbox will return back to being useable.

NOTE : If you are Hybrid you will need these changes to replicate from AD via AD-Connect before they become live

If you wish to enable archiving for one user, you can run this:

 Enable-Mailbox -Identity <mailbox> -Archive

If you wish to enable archiving for all users with it off, you can run this:

Get-Mailbox -Filter {ArchiveGuid -Eq "00000000-0000-0000-0000-000000000000" -AND RecipientTypeDetails -Eq "UserMailbox"} | Enable-Mailbox -Archive

Purge the Dumpster

If you wish to purge the dumpster after you have either not been able to do the above or just need the command then its this:

Search-Mailbox -Identity <mailbox> -SearchDumpsterOnly –DeleteContent
Optional : For an archived dumpster you need to use this:

Search-Mailbox -Identity <mailbox> -Archive -SearchDumpsterOnly –DeleteContent
🚒
Previous Post Next Post

نموذج الاتصال