• Status: Solved
  • Priority: Low
  • Security: Public
  • Views: 65
  • Last Modified:

MS Exchange Powershell for Deletion of Deleted Items folder

I had this question after viewing Exchange 2013 Powershell - clean up Deleted Items folder based on date.
When I am tying to delete emails in deleted items folder using following command it run successfully but items from Deleted Items folder are not deleting.
Search-Mailbox -Identity user1-SearchQuery '#deleted items#' -DeleteContent
Amjad Ali
Amjad Ali
  • 4
3 Solutions
timgreen7077Exchange EngineerCommented:
unfortunately you can't delete items from a single folder like that. the search mailbox cmdlet will search entire mailbox unless you specify it to search the dumpster only parameter, but you can't search and delete items from select folders. #deleted items# doesn't work with search-mailbox cmdlets.
FOXActive Directory/Exchange EngineerCommented:
Search-Mailbox -Identity 'Mailbox' -SearchDumpsterOnly -DeleteContent

**also check to see if this user has litigation hold on the mailbox** If so you will have to turn it off.
Amjad AliSystem EngineerAuthor Commented:
Thanks timgreen7077 & FOX.  Is there any way out to resolve the issue stated below:
"I want to delete items in Deleted Items folder of a particular mailbox using power shell."
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

timgreen7077Exchange EngineerCommented:
No there is isn't, because unfortunately you can't delete based on folders as a criteria, if choose to delete based on date it will scan entire mailbox and delete based on the date and not just the delete items folder.

If you have to delete from that folder based on date, just open outlook and sort that deleted items folder by date and then delete the items, but this can't be done via the shell from that folder specifically.
timgreen7077Exchange EngineerCommented:
@FOX the cmdlets you are providing is for the recovery dumpster and not the deleted items folder. The recovery dumpster is where the items deleted from the "deleted items" folder goes while waiting for exchange to purge based on policy. That cmdlet will not work for this request.
timgreen7077Exchange EngineerCommented:
Answered question. Closing unless author reopens question.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now