Tuesday, February 10, 2009

Import-Mailbox cmdlet gives statuscode -2147221219

For a customer I had to create a method for importing multiple PST-files into a new Exchange Server 2007 Environment. The PST-files were already exported with ExMerge from Exchange Server 2003.

If you want to import mailboxes I usualy use the cmdlet 'Import-Mailbox'. This cmdlet is part of the Microsoft Exchange Server 2007 Management Shell. For more information on how to use this cmdlet, visit this site.

When I started the import, it throws me the following error:
StatusCode : -2147221219
StatusMessage : Error occurred in the step: Approving object. An unknown error has occurred.
ReportFile : C:\Program Files\Microsoft\Exchange Server\Logging\MigrationLogs\import-Mailbox20090209-103301-5655000.xml

I tried to import another PST-file but I got the same error as mentioned above. I figured out is was a consistent error. To troubleshoot this i checked the following possibilities:
  • I can open the mailbox on the server with an Outlook-client
  • I have the correct credentials on the users mailbox
  • I have the correct credentials on the Exchange Server having the MailboxRole.
  • I googled the error. Plenty of hits with many solutions, but none according to the above error.
  • I looked at the ReportFile. A lot of XML-code and the same error as mentioned above, but it explains nothing.
  • I exported the empty mailbox and I imported again. No errors.
Non of the above gave me a clue.

Then I ran the cmdlet with the '-debug' option so I could figure out at wich step the import went wrong. This opens my eyes.

During the step 'Approving object' the cmdlet opens the PST-file and tries to get access to the objects (mail/calender/etc.) within the PST-file. If the action succeeds, the objects wil be moved (read copied) to the mailbox on the server. For some reason, the PST-file couldn't be opened.

Opening the PST-file with my Outlook-client shows an empty mailbox (the file is about 800MB) and I was not questioned to give up a password.

Than, I decided to import my own PST-file into the mailbox and it gave no error.
Ok. Let's put password protection on my own PST-file and start the import again.

Bingo! I got the same error as above. It looks like the PST-files were exported with the option 'with user password'.

After I got a new export the import did not give any errors anymore.