• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 702
  • Last Modified:

Powershell Command to copy a email with specific subject another mailbox failing

Command run with errors:

Get-Mailbox -ResultSize Unlimited | Export-Mailbox -SubjectKeywords "My dog has fleas" -TargetMailbox DeletedContent -TargetFolder 'EmailBackup' -DeleteContent

I want to be able to remove phishing email that hits our Email Server very quickly and this is a test run.  Running the following command as Exchange Admin/local server admin/Full mailbox rights on all users/mailboxes on Exchange 2007 Backend Server.  Command processes but does not create user folder within "EmailBackup" Folder of mailbox "DeletedContent".  We get a few errors:  "Error creating target folder in target mailbox - error code: -2147221233.  We can just delete the emails successfully via:

Get-Mailbox -ResultSize Unlimited | Export-Mailbox -SubjectKeywords "My dog has fleas" -StartDate "08/28/2012" -EndDate "08/29/2012" -DeleteContent
1 Solution
This error means that the account that you are using doesn't have full mailbox rights on "DeletedContent" mailbox.

provide appropriate permission, let AD Replicate - then try again.

cwiuserAuthor Commented:
I was able to get it to work, but it creates a folder structure for every user processed not just the mailbox which has an email with the subject line; not very user friendly at the end of the day.
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

Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

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