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 AliSystem EngineerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.
0
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."
0
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

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.
0
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.
1
timgreen7077Exchange EngineerCommented:
Answered question. Closing unless author reopens question.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.