I've got an issue with using Export-Mailbox cmdlet in Powershell to delete emails between two dates from a mailbox. The current code that I am running is:
Export-Mailbox -Identity mailboxname -StartDate "01/11/2009 00:00:01" -EndDate "14/11开发者_运维技巧/2009 00:00:01" -DeleteContent
I know there are emails that fall between these two dates, but every time the command runs and completes but gives a status message of "Error occurred in the step: Moving messages. Failed to copy messages to the destination mailbox store with error: An unknown error has occured."
Has any had success with using Export-Mailbox to delete messages, or know why this is erroring out?
Thanks.
- Jonny
~~~ SOLUTION ~~~
Using the help from David I ran the command again as follows:
Get-Mailbox -Identity jonny | Export-Mailbox -TargetMailbox target -TargetFolder folder -EndDate "14/11/09 00:01:00" -StartDate "14/11/09 00:00:00" -DeleteContent
This worked as long as there weren't any more than 3000 emails in that timespan.
Try:
Get-Mailbox -Identity Jonny | Export-Mailbox -TargetMailbox mailboxname -StartDate "01/11/2009 00:00:01" -EndDate "14/11/2009 00:00:01" -DeleteContent
See this for more info about the most common problems using Export-Mailbox:
The most common problems with using Export-Mailbox are related to permissions. To use Export-Mailbox you need to be delegated the Exchange Server Administrator role, be a member of the local Administrators group for the target server, and have full access to the source and destination mailboxes. The source and destination mailboxes must be in the same Active Directory forest.
These are some common permissions-related errors:
ERROR
- The specified mailbox database [Mailbox Database Name] does not exist
CAUSE The user running the Export-Mailbox command needs to be delegated the Exchange Administrator role for the Exchange server.
ERROR
- Error occurred in the step: Creating target folder in the target mailbox. An unknown error has occurred., errorcode: -2147221233
CAUSE The user running the Export-Mailbox does not have full access to the destination mailbox.
ERROR
- Error occurred in the step: Moving messages. Failed to copy messages to the destination mailbox store with error: MAPI or an unspecified service provider. ID no: 00000000-0000-00000000, error code: -1056749164”
CAUSE The user running the Export-Mailbox does not have full access to the destination mailbox.
I was also getting below error, I moved source mailbox to another store and it then worked.
•Error occurred in the step: Moving messages. Failed to copy messages to the destination mailbox store with error: MAPI or an unspecified service provider. ID no: 00000000-0000-00000000, error code: -1056749164”
精彩评论