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

Posted on 2012-08-29
Last Modified: 2012-08-30
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
Question by:cwiuser
    LVL 33

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


    Author Comment

    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.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    Set OWA language and time zone in Exchange for individuals, all users or per database.
    Local Continuous Replication is a cost effective and quick way of backing up Exchange server data. The following article describes the steps required to configure Local Continuous Replication. Also, the article tells you how to restore from a backup…
    Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
    Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now