[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


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

Posted on 2012-08-29
Medium Priority
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

Exchange_Geek earned 600 total points
ID: 38348263
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

ID: 38352523
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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

With so many activities to perform, Exchange administrators are always busy in organizations. If everything, including Exchange Servers, Outlook clients, and Office 365 accounts work without any issues, they can sit and relax. But unfortunately, it…
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Suggested Courses

872 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