question

71425117 avatar image
0 Votes"
71425117 asked EricYin-MSFT commented

How to forcibly clean up deleted messages in the database, bypassing the policy of storing deleted messages in 14 days?

Good day!

In the settings of user mailboxes in Exchange 2013 there is an option: "Keep deleted items for n days." By default, everyone has 14.

The user cleared his mailbox, and I need this deleted data to be immediately cleaned up on the database and free space.

Are there any commands for this?

I have set the storage option "Keep deleted items..."for this user to 0 days. But the place in the database was not vacated.

Question: the set value of 0 days will be valid only for newly deleted messages, and the previously deleted ones will still be kept for 14 days?

office-exchange-server-administration
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AndyDavid avatar image
0 Votes"
AndyDavid answered AndyDavid rolled back

Make sure the mailbox is not using the database defaults:
Set-mailbox <user> -UseDatabaseRetentionDefaults:$false

and it should work overnight


If not then you can do this:

Set to 0 on the database and UseDatabaseRetentionDefaults to $true on the mailbox and it should be cleared out overnight. Not really a good way to force it however

so:

 set-mailboxdatabase <DB> -DeletedItemRetention 0 -RetainDeletedItemsUntilBackup:$False

https://docs.microsoft.com/en-us/powershell/module/exchange/set-mailboxdatabase?view=exchange-ps

and for the mailbox:

 set-mailbox <user> -UseDatabaseRetentionDefaults:$true

https://docs.microsoft.com/en-us/powershell/module/exchange/set-mailbox?view=exchange-ps

NOTE: This will clear it for ALL the mailboxes on that database, so ensure of you DO NOT want to do this for all that the other mailboxes are set:


set-mailbox <user> -UseDatabaseRetentionDefaults:$false


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

EricYin-MSFT avatar image
0 Votes"
EricYin-MSFT answered EricYin-MSFT commented

Question: the set value of 0 days will be valid only for newly deleted messages, and the previously deleted ones will still be kept for 14 days?

  • I tried to set the value to 0, using MFC MAPI to compare the properties of a message that should be kept in deletions for 14 days and 0 days, but unfortunately there's not any values that work like PR_Retention_Date, only last modification time and message creation time:
    85535-3.png

So I back to official doc and found something might related: Clean up or delete items from the Recoverable Items folder
When he changes the settings, the Microsoft Exchange Mailbox Assistants service need to be stopped, which might mean if you don't stop the service, those settings changes at once.

All above is just my guess, hope it helps.


If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.




3.png (17.3 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I am writing here to confirm with you how the thing going now?
If you need further help, please provide more detailed information, so that we can give more appropriate suggestions.


If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 Votes 0 ·