2

How would I safely export data from Exchange 2010 mailboxes to PSTs using New-MailboxExportRequest and have the exported items deleted from the source mailbox? The Powershell cmdlet seems to be missing the -DeleteContent switch which has been part of the Export-Mailbox cmdlet in Exchange 2007.

Using Search-Mailbox -DeleteContent after the MailboxExportRequest has completed seems like a bad idea since I really only want to delete items which have been successfully exported and I could not find any way to obtain a comprehensive list of items processed by New-MailboxExportRequest.

the-wabbit
  • 40,737
  • 13
  • 111
  • 174
  • I don't see any form of message system on this site so I'm adding a comment here. Did you ever find a solution to this? I've run into the same problem. I need to delete all messages over 20MB in size. I can export them but with the delete option gone I can't delete them and the search function wont recognize SIZE. So I can't delete them that way either. I tried to parse MailboxExportRequestStatistics but there's nothing there to pipe into the search function. So the one answer below seems to be a dead end. – Justin Emlay Mar 26 '15 at 16:51

1 Answers1

3

Even so, Search-Mailbox is the way to go forward, please read the following two paraphrases from http://technet.microsoft.com/en-us/library/dd298173%28v=exchg.141%29.aspx:

"The DeleteContent switch specifies that the messages returned by the search be permanently deleted from the source mailbox. When used with the TargetMailbox parameter, messages are copied to the target mailbox and removed from the source mailbox"

"Before you use the DeleteContent switch to delete content, we recommend that you test search parameters by using the LogOnly parameter, as shown in Example 2."

I suggest you check http://technet.microsoft.com/en-us/library/ff459253%28v=exchg.141%29.aspx and (possibly re)write your current script(s accordingly)

Andor
  • 152
  • 2
  • 8
  • Andor, thank you for answering. However, I cannot see how I would make sure that I actually have exported every element which is going to be deleted. I cannot enumerate the data in the PST after it is exported, I cannot get a list of what is exported from the MailboxExportRequest, so how do I handle the situation? – the-wabbit Apr 24 '13 at 06:41
  • First of, my apologies for the seemingly long delay in responding (I've been nightmare busy, and apparently overlooked the ServerFault notifier, somehow(?)). To get details to such requests, you should use the CMD-let Get-MailboxExportRequestStatistics [link](http://technet.microsoft.com/en-us/library/ff607297%28v=exchg.141%29.aspx) – Andor Sep 11 '13 at 12:19