Deleting multiple emails in Inbox using Powershell.

We have a mailbox that we use for our SPAM Notifications and we have over 40,000 emails in the mailbox.  What PowerShell command can I use to delete them all?  We are using Exchange 2010 SP3 with Office 2013.
JimmyRiversideEmail AdministratorAsked:
Who is Participating?
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.

LeoCommented:
Try This;

export-mailbox -id 'mailbox' -deletecontent -confirm:$False

If that doesn't work, try this;

Search-Mailbox -Identity "Nam_of_mailbox" -DeleteContent -Force
1
HariomExchange ExpertsCommented:
Get-Mailbox -Identity dschatz | Search-Mailbox -ContentFilter {((Received -lt ’12/06/1990') -and (Received -ge ’04/01/2013'))} -DeleteContent -force

OR

Use the following command below which will delete all email for mailbox in your Exchange environment up until August 25th 2015.

search-mailbox -identity <username> -SearchQuery "Received:<$('25/08/2015')" -deletecontent

Also

You can delete e-mails using auto archive option available in outlook

Click the File tab.

Click Options.

Click Advanced.

Under AutoArchive, click AutoArchive Settings.

Select the Run AutoArchive every n days check box, and then specify how often to run AutoArchive.

Select any other options that you want. You can choose to have old items deleted automatically at AutoArchive.
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
imkotteesSenior Messaging EngineerCommented:
Hi, Just for a fun you can try this way. Configure an outlook profile for this mailbox-> set pst as local delivery, let it download everything and put it back to normal delivery:)
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
Email Clients

From novice to tech pro — start learning today.

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.