SOLVED

How to clear the Discovery Holds folder

Brass Contributor

To find whether this discovery holds folder is completely full, use the below-mentioned command. 

 

Step 1: Connect-ExchangeOnline

 

and then,

 

Step 2: Get-MailboxFolderStatistics -Identity user | select name,foldersize

 

venkatkirankona_0-1670662131417.png

 

Note: This DiscoveryHolds folder is having a limit of 100 GB. If it is full, we will get issues like "Unable to clear deleted items folder", "deleted items are getting auto-restored" etc.,

 

One of the reasons for this folder is full: If Organization Hold is turned on(All Exchange mailboxes are selected in Compliance Retention Policy) or the Individual ID is selected on Compliance Retention Policy. 

 

Solution

 

Please try the below-mentioned steps to overcome this issue. 

 

Step 1: Exclude the DiscoveryHolds full ID in the Compliance Retention policy or run the below-mentioned commands in PowerShell. 

 

Connect-IPPSSession

 

and then,

 

Set-RetentionCompliancePolicy -Identity "Compliance Retention Policy Name" -AddExchangeLocationException user

 

for multiple users, 

 

Set-RetentionCompliancePolicy -Identity "Compliance Retention Policy Name" -AddExchangeLocationException user1, user2, user3

 

Now on PowerShell, 

 

Connect-ExchangeOnline

 

and then, 

 

Set-Mailbox -Identity user -RetainDeletedItemsFor 0

 

and then run the below-mentioned command two times. 

 

Start-Managedfolderassistant -Identity user

Start-Managedfolderassistant -Identity user

 

After 2-3 minutes, run the below-mentioned commands. 

 

Get-Mailbox "user" | FL DelayHoldApplied,DelayReleaseHoldApplied

 

If the output is received as true for any above-mentioned holds, then run the below-mentioned commands. 

 

Set-Mailbox user -RemoveDelayHoldApplied
Set-Mailbox user -RemoveDelayReleaseHoldApplied

 

and then run the below-mentioned command two times. 

 

Start-Managedfolderassistant -Identity user

Start-Managedfolderassistant -Identity user

 

After 2-3 minutes, this DiscoveryHolds folder will become zero as per the below-mentioned screenshot. 

 

venkatkirankona_1-1670663173460.png

 

This process helped me a lot. If you have any doubts/concerns/suggestions about this post, please comment below. 

 

Best Regards,

Venkat Kiran Kona. 

8 Replies
best response confirmed by venkatkirankona (Brass Contributor)
Solution

Great post, thank you. This helped me when both RecoveryItems and DiscoveryHolds were full. We had a lot of retention policies, so using this command excluded them from all polices:

 

 

Get-RetentionCompliancePolicy | foreach {Set-RetentionCompliancePolicy -identity $_.name -AddExchangeLocationException <user>}

 

 

Also, it can take a lot more than a few minutes if the mailbox has a lot of items (in my case, 100GB). It's going very slow for me, maybe 1GB every hour or two.

Try to run this "start-managedfolder" command 2 times at once and repeat every 5 mins.

Thanks for the response btw and good to see that this is helpful.

@venkatkirankona 

This is working perfectly! I came in this morning and the deletions had stalled, tried your method of running it twice every 5 minutes and it's dropped from 99GB to 58GB in about an hour. Here's a snippet to do this every 5 mins automatically, and report the size of the folders:

while ($true) {
    Start-ManagedFolderAssistant -Identity <email address removed for privacy reasons>
    Start-ManagedFolderAssistant -Identity <email address removed for privacy reasons>
    sleep 300
    Get-MailboxFolderStatistics <email address removed for privacy reasons> -FolderScope RecoverableItems | Ft Name,FolderAndSubfolderSize
    }

 

This is great @koakd540. Thank you :)

@venkatkirankona 

 

Hi this is something I've been looking for.

can you help me on this? i tried what you did but it doesnt work for me.

 

Set-Mailbox -Identity xyz -RetainDeletedItemsFor 0
Start-Managedfolderassistant -Identity xyz
Start-Managedfolderassistant -Identity xyz
Get-Mailbox xyz | FL DelayHoldApplied,DelayReleaseHoldApplied

>>DelayHoldApplied : False
>>DelayReleaseHoldApplied : False


Get-MailboxFolderStatistics -Identity xyz | select name,foldersize
Get-RetentionCompliancePolicy | foreach {Set-RetentionCompliancePolicy -identity $_.name -AddExchangeLocationException xyz}

Start-Managedfolderassistant -Identity xyz
Start-Managedfolderassistant -Identity xyz


Get-MailboxFolderStatistics -Identity xyz | select name,foldersize
Start-Managedfolderassistant -Identity xyz
Start-Managedfolderassistant -Identity "email address removed for privacy reasons"

 

Get-MailboxFolderStatistics -Identity xyz | select name,foldersize

EPWidjaya_0-1698856356920.png

 

Thank you so much for this info. This worked for the issue we were having, my question would be how do I undo the changes to the affected mailbox? I'm talking about the settings like Set-RetentionCompliancePolicy -Identity "Compliance Retention Policy Name" -AddExchangeLocationException user and the -retaindeleteditemsfor settings.
What is the error?

Before running these commands, you need to exclude the IDs on compliance retention policy.
We can remove the same excluded ones by using commands else by going to the compliance portal to the "retention policy".
1 best response

Accepted Solutions
best response confirmed by venkatkirankona (Brass Contributor)
Solution

Great post, thank you. This helped me when both RecoveryItems and DiscoveryHolds were full. We had a lot of retention policies, so using this command excluded them from all polices:

 

 

Get-RetentionCompliancePolicy | foreach {Set-RetentionCompliancePolicy -identity $_.name -AddExchangeLocationException <user>}

 

 

Also, it can take a lot more than a few minutes if the mailbox has a lot of items (in my case, 100GB). It's going very slow for me, maybe 1GB every hour or two.

View solution in original post