Exchange 2007 mailbox with too many messages
Is there a way to delete messages prior to a certain date. have a mailbox that has no limit and has not been managed properly but would like to keep the most recent. has too many messages and outlook hangs while downloading only the headers. thanks
November 10th, 2008 5:57pm

You can run Export-Mailbox with DeleteContent and EndDate option to remove messages. You can read more about options here: http://technet.microsoft.com/en-us/library/aa998579.aspx
Free Windows Admin Tool Kit Click here and download it now
November 10th, 2008 6:07pm

thank you for your reply. I will read up on the link you sent. I haven't tried any of the management shell cmdlets yet. afraid I'll shoot my foot off. If I need further help on the syntax, I'll repost to this. thanks again
November 10th, 2008 6:18pm

Feel free to respond back if you need help with syntax. You can always use WhatIf, Confirm and ValidateOnly parameters to your advantage and to avoid costly mistakes. You can read more about these parameters here: http://technet.microsoft.com/en-us/library/bb124088.aspx.
Free Windows Admin Tool Kit Click here and download it now
November 10th, 2008 10:51pm

thought I had the syntax right but came back with an error that I cannot find a reference for. export-Mailbox -identityuser -DeleteContent -StartDate 01/01/2008 -EndDate 10/1/2008 Export-Mailbox : Error was found foruser because: Erroroccurred in the step: Moving messages. Failed to copy messages to the destination mailbox store with error: An unknown error has occurred., error code: -1056749164At line:1 char:15+ export-Mailbox <<<< -identityuser -DeleteContent -StartDate 01/01/2008 -EndDate 10/1/2008 any thoughts? thanks
November 11th, 2008 11:08am

Export-Mailbox requires destination where you are going to export mails and then delete it from source mailbox. By this logic, you need destination which is what you are missing. Here is what the syntax should look like. Tailor it to your liking. Code Snippet Export-Mailbox -Identity user -PSTFolderPath C:\PSTFiles\user.pst -DeleteContent -StartDate 01/01/2008 -EndDate 10/1/2008 -WhatIf Export-Mailbox -Identity user -PSTFolderPath C:\PSTFiles\user.pst -DeleteContent -StartDate 01/01/2008 -EndDate 10/1/2008 -Confirm I have two commands above. One is for simulation of what will happen if you were to actually run this command. No changes are made. If the output looks good, run the second command. This will ask for confirmation before it actually carries out the operation. Once this is complete, you should have a PST with items removed from mailbox. You can provide the PST to the user if needed or simply delete it if not needed.
Free Windows Admin Tool Kit Click here and download it now
November 11th, 2008 11:30am

when I tried the above after creating the PSTFiles - I got this response: C:\Documents and Settings\gjohnson>Export-Mailbox -identity datatel -PSTFolderPath C:\PSTFiles\datatel_111108.pst -DeleteContent -StartDate 01/01/2008 -EndDate 10/1/2008 -WhatIfYou are running on a 64-bit computer. To export to or import from a .pst file,you must be running a 32-bit computer that has Outlook 2003 SP2 or later installed. Trying it again without the exporting to a .pst file - thought I read that I could just use the -DeleteContent [PS] C:\Documents and Settings\gjohnson>Export-Mailbox -identity junk@datatel.com -DeleteContent -StartDate 01/01/2008 -EndDate 10/1/2008 -WhatIfWhat if: Searching the contents and/or the associated messages from the mailbox'Datatel' and deleting those messages that meet the criteria specified. This operation may take a long time to complete.[PS] C:\Documents and Settings\gjohnson>Export-Mailbox -identity junk@datatel.com -DeleteContent -StartDate 01/01/2008 -EndDate 10/1/2008 -Confirm ConfirmAre you sure you want to perform this action?Searching the contents and/or the associated messages from the mailbox'Datatel' and deleting those messages that meet the criteria specified. Thisoperation may take a long time to complete. Yes Yes to All No [L] No to All Suspend [?] Help(default is "Y"):YExport-Mailbox : Error was found for Datatel (junk@datatel.com) because: Erroroccurred in the step: Moving messages. Failed to copy messages to the destination mailbox store with error: An unknown error has occurred., error code: -1056749164At line:1 char:15+ Export-Mailbox <<<< -identity junk@datatel.com -DeleteContent -StartDate 01/01/2008 -EndDate 10/1/2008 -Confirm received: Identity : datatel.com/Users/DatatelDistinguishedName : CN=Datatel,CN=Users,DC=datatel,DC=comDisplayName : DatatelAlias : datatelLegacyExchangeDN : /o=First Organization/ou=First Administrativ e Group/cn=Recipients/cn=junkPrimarySmtpAddress : junk@datatel.comSourceServer : dt-exch07.datatel.comSourceDatabase : DT-EXCH07\First Storage Group\Mailbox Databa seSourceGlobalCatalog : DTSERVERSourceDomainController :TargetGlobalCatalog : DTSERVERTargetDomainController :TargetMailbox :TargetServer :TargetDatabase :MailboxSize : 728173KBIsResourceMailbox : FalseSIDUsedInMatch :SMTPProxies :SourceManager :SourceDirectReports :SourcePublicDelegates :SourcePublicDelegatesBL :SourceAltRecipient :SourceAltRecipientBL :SourceDeliverAndRedirect :MatchedTargetNTAccountDN :IsMatchedNTAccountMailboxEnabled :MatchedContactsDNList :TargetNTAccountDNToCreate :TargetManager :TargetDirectReports :TargetPublicDelegates :TargetPublicDelegatesBL :TargetAltRecipient :TargetAltRecipientBL :TargetDeliverAndRedirect :Options : DeleteSourceContentSourceForestCredential :TargetForestCredential :TargetFolder :PSTFilePath :RsgMailboxGuid :RsgMailboxLegacyExchangeDN :RsgMailboxDisplayName :RsgDatabaseGuid :StandardMessagesDeleted : 0AssociatedMessagesDeleted : 0DumpsterMessagesDeleted : 0MoveType : DeleteOnlyMoveStage : MoveStartTime : 11/11/2008 10:30:35 AMEndTime : 11/11/2008 11:15:27 AMStatusCode : -1056749164StatusMessage : Error occurred in the step: Moving messages. Failed to copy messages to the destination mailbox store with error: An unknown error h as occurred.ReportFile : E:\Exchange\Logging\MigrationLogs\export-Mai lbox20081111-103026-1584678.xml
November 11th, 2008 1:34pm

The following isn't ideal because it will require a mailbox and when you delete the malibox, it will leave some whitespace in database. Create a temp mailbox, and use -TargetMailbox TempMailbox -TargetFolder TempData instead of -PSTFolderPath C:\PSTFiles\user.pst. This will export data to tempmailbox and then delete from source. You can then delete the destinationmailbox to get rid of the data you don't need. You can use existing mailbox if you wish.
Free Windows Admin Tool Kit Click here and download it now
November 11th, 2008 2:16pm

can you please clarify what "the following" is? You seem to contradict yourself in the two messages. Are you saying that using your code snippet will create white space in the database and that it would be better to move the items I wish to delete to a mailbox in the same store, then delete the mailbox?? "Export-Mailbox -Identity user -PSTFolderPath C:\PSTFiles\user.pst -DeleteContent -StartDate 01/01/2008 -EndDate 10/1/2008 -WhatIf" Can you tell me if running this command will cause db problems??? export-mailbox -identity sean -pstfolderpath g:\psts\SeanPre2011.pst -enddate 12/31/2010 -deletecontent Thanks
March 22nd, 2012 11:48am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics