Exchange 2010 powershell script

Hi Experts,

- I am domain admin of our network.
- windows exchange 2010 on server 2008R2
- running exchange management shell as administrator

I have a user that has 10's of thousands of email in his junk mail and deleted times. There are too many delete them using outlook.

I am trying to find a power shell script that will allow me to do the deleting from there.

Been searching  but not coming up with anything precise on deleting mail items only. Obviously I need to be careful so I don't to blow the mailbox away :-)

Thanks
Cindy (latteandcoffee)
latteandcoffeeAsked:
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.

CESNetwork AdministratorCommented:
This should do for the deleted items:

Get-Mailbox user1 | Export-Mailbox -DeleteContent -IncludeFolders "\deleted items"

The junk folder should be similar "junk items" or something like that.

Here is a relevant KB from MS:

https://technet.microsoft.com/en-us/library/ff459253(v=exchg.141).aspx
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
Amit KumarCommented:
By following above make sure you set Retention of deleted items to 0 else once recovery dumpster is full no e-mails will be deleted. Once all unwanted e-mails are deleted then change retention of deleted items.
0
PberSolutions ArchitectCommented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

Split:
-- CES (https:#a42407980)
-- Amit Kumar (https:#a42408785)


If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

Pber
Experts-Exchange Cleanup Volunteer
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.