“Header file length is zero” when exporting a mailbox
For years, I’ve been importing and exporting mailboxes with relatively no problems, when I started getting this error when exporting a number of mailboxes:
|[PS] C:\Windows\system32>New-MailboxExportReqeust john.doe -FilePath \\server\share\john.doe.pst
Unable to open PST file ‘\\server\share\john.doe.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.
The export request statistics contained…
Now, if I attempted to run the export again, I got this error…
|The server or share name specified in the path may be invalid, or the file could be locked.
+ CategoryInfo : NotSpecified: (0:Int32) [New-MailboxExportRequest], RemotePermanentException
+ FullyQualifiedErrorId : AC199ECB,Microsoft.Exchange.Management.RecipientTasks.NewMailboxExportRequest
…and couldn’t delete the pst file either.
Repairing the mailbox didn’t help.
Here’s what I did to fix it:
1. I removed the export request with Get-MailboxExportRequest -Status Failed | Remove-MailboxExportRequest
2. I released the broken pst file by restarting the Microsoft Exchange Mailbox Replication service on the CAS. (Did I mention that this is on an Exchange 2010 server?) I was then able to delete it.
At this point, I could resubmit the move request and some mailboxes would export OK and others wouldn’t with no discernible pattern. Most of the time, I would get the same errors. I did notice one similarity between all of these mailboxes, however: They were all on the same database.
3. I moved the mailbox to a different database.
When I resubmitted the move request, it ran without a hitch. Now, I might have to create a new mailbox and move all the mailboxes off of this one before I delete it.