Alert for recoverable deleted items

Copper Contributor

Hello All , 


In my org we have 2000 users ... We have retention policy in Data life cycle mgmt to retain all emails for ever.


This results into exceeding threshold of 100GB of RDI (Recover deleted Items)

~ Can we set up some alert, using power automate or script which will let us know user who are exceeding this limit or bound to exceed this limit.



1 Reply
Hi Swapnil,
You can have a weekly script checking each mailbox recoverable items size. Something like it:

$AllUsers = Get-Mailbox -RecipientTypeDetails UserMailbox -ResultSize Unlimited | Select-Object PrimarySMTPAddress

$a = 0
foreach ($Mailbox in $AllUsers)
Get-EXOMailboxFolderStatistics -Identity $Mailbox.PrimarySMTPAddress -FolderScope RecoverableItems | Where-Object {$_.FolderPath -eq "/Recoverable Items"} | Select-Object Identity,@{name="FolderAndSubFolderSize"; expression={[math]::Round(($_.FolderAndSubFolderSize.ToString().Split("(")[1].Split(" ")[0].Replace(",","")/1MB),2)}} | export-csv D:\All-Users-Folder-Size.csv -Append -NoTypeInformation
Write-host "Processing Mailbox" $Mailbox.PrimarySMTPAddress

#Saving output for sending the report via email
Import-csv D:\All-Users-Folder-Size.csv | Sort-Object {[int]$_.FolderAndSubFolderSize}, Identity -Descending | Export-csv D:\All-users-Sorted.csv -NoTypeInformation
Remove-Item -Path D:\All-Users-Folder-Size.csv

Send-MailMessage -From 'email address removed for privacy reasons' -To 'email address removed for privacy reasons'-Subject "Recoverable Items Report' -Body "Recoverable Items Report" -Attachments D:\All-users-Sorted.csv -Priority High -DeliveryNotificationOption OnSuccess, OnFailure -SmtpServer ''