powershell delete specific emails

we have exchange 2007 running and i want to create a powershell script to delete all messages from a specific mailbox where sender = "USER".  it all points to export-mailbox.  needs some assistance.

i also need a powershell script to delete all emails for a specific mailbox in their deleted items folder
team_ironAsked:
Who is Participating?
 
shauncroucherCommented:
You don't need to specify a target mailbox or folder if you do not want to.

See my blog entry on this: http://exchangeshell.wordpress.com/2009/08/10/export-mailbox-for-deleting-content-from-mailboxes/

You can just run  Export-Mailbox "UserMailbox" -Senderkeywords "senderemail" -Deletecontent
 
Shaun
0
 
AkhaterCommented:
assuming you are using the administrator user and you want to search the name@domain.com mailbox

add-mailboxpermission name@domain.com -user administrator -accessright FullAccess

then

export-mailbox name@domain.com -senderkeywords "user@domain.com" -targetmailbox "administrator" -targetfolder "whatever" -deletecontent:$true

0
 
team_ironAuthor Commented:
do you need to specify a target mailbox and targetfolder?
0
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.

 
AkhaterCommented:
yes you do
0
 
team_ironAuthor Commented:
that makes sense. i will try that
0
 
AkhaterCommented:
I stand corrected , thanks Shaun never even thought of removing these parameters

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

All Courses

From novice to tech pro — start learning today.