Link to home
Start Free TrialLog in
Avatar of cwiuser
cwiuser

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of Exchange_Geek
Exchange_Geek
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cwiuser
cwiuser

ASKER

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.