-->

Friday, September 26, 2014

Exchange 2010 Mailbox Export Error: Header file length is zero

While exporting some monster-sized mailboxes (and I mean 17GB monsters) to PST's, some of them inevitably failed because any time you're moving/exporting huge mailboxes the chances are very high that there will be corrupted items. When I went to retry the exports, PowerShell threw out the error below:

Unable to open PST file '\\ServerShare\PST\username.pst'. Error details: Header file length is zero. If this file is from a previously failed pst export, please delete the file and resume the export.
+ CategoryInfo          : NotSpecified: (0:Int32) [New-MailboxExportRequest], RemotePermanentException
+ FullyQualifiedErrorId : 53882154,Microsoft.Exchange.Management.RecipientTasks.NewMailboxExportRequest


In order to get those exports going again, first, you need to delete the PST files. If you can't delete the files because they are locked by another process, you can either restart the Exchange Replication Service on the CAS server(s) -or- on the server housing the shared drive, go into Computer Manager > Shared Folders > Open Files, right-click them and kill the connection.
After you've deleted the PST files, you'll need to edit your export command or script and add these two switches: -BadItemLimit 10000 and -AcceptLargeDataLoss so it looks like this:

New-MailboxExportRequest -Mailbox "alias" -BadItemLimit 10000 -AcceptLargeDataLoss -FilePath \\ServerShare\PST\alias.pst

**Note** Change "alias" and the -filepath to match your environment

Setting the -BadItemLimit to a high value will allow you to export the mailboxes, even though corrupt items are present, and setting the -AccepLargeDataLoss will tell PowerShell that you are sure you want to proceed even though there might be some corruption.

Now your huge mailbox exports should chug along!

3 comments:

  1. I had the same problem, but with very small mailboxes. I fixed it by moving the mailboxes to a different database, so I'm pretty sure the problem was in the original database. See here: http://exchangetips.us/2015/12/header-file-length-is-zero-when-exporting-a-mailbox/

    ReplyDelete
    Replies
    1. Awesome, thanks for the tip, Jay! Could you discern what was causing it on the database level? Any specific errors?

      Delete
  2. Thanks Stacey, I was looking for someway to drop the connection to the .pst file.

    ReplyDelete