Hi @Patr_UK ,
I am looking for a cmd to delete any email located in the deleted items of an on-prem mailbox.
Agree with Vasil that it's not feasible to do it using the native cmdlets. If scripting this with EWS is not an acceptable option for you, you can follow the steps below to create a new retention policy and apply it to the mailbox：
- Create a retention tag for the deleted items folder:
- Create a new retention policy and add the above retention tag into it:
- Apply this retention policy to the mailbox:
- Run the command below to force the change to take effect:
Start-ManagedFolderAssistant -Identity <MailboxIdentity>
In my case, there's no retention policy applied to this mailbox, so the retention age is calculated starting from the current date. As can be seen in the image below, items in the Deleted Items folder of the mailbox I selected is shown will expire in 1 day, which means the policy has taken effect and items inside this folder will be permanently deleted in 1 day.
Note: If you only need to remove the old items, remember to remove the retention policy afterwards.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
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.