How to Export a List of Mailboxes to PST files on 2007 Exchange Server

Printer-friendly versionPDF version
How to Export a List of Mailboxes to PST files on 2007 Exchange Server

You can use the Export-Mailbox command to easily export mailboxes from an Exchange 2007 system, but if you want to export a list of mailboxes, you'll need a script to help out.

First, you'll need to get the contents of your text file with the list of mailboxes. Each mailbox name should be on a separate line in the file:

$content = Get-Content "C:\ListOfMailboxes.txt"

You can use the one liner below to take the list of mailboxes and export them all to pst files:

foreach ($user in $content){Export-Mailbox $user -PSTFolderPath "C:\Export" -BadItemLimit 3000 -ExcludeFolders "\Junk E-Mail" -Confirm:$false}

This article assumes you already know how to use the Export-Mailbox command, and have configured the prerequisites. If not, please refer to this blog article from Microsoft.

I'll break down each part of this one liner to show you exactly what it's doing:

foreach ($user in $content) - This is just a basic for loop. Each line in the text file is placed into the variable $user and processed.

Export-Mailbox $user - The main export command. Uses the mailbox name variable $user

-PSTFolderPath "C:\Export" - The folder you want the PST files exported to. Can be a UNC path.

-BadItemLimit - Optional. The number of bad items allowed before the export fails.

-ExcludeFolders - Optional. Save some time and space, no one needs the junk folder, so exclude it, as well as any other folders you like.

-Confirm:$false - This makes it automatically say yes to any confirmation prompts. If you don't add this, the command will pause for confirmation before each export

This will help you bulk export your pst files to PST files. If this helps you out, please leave a comment below to let other users know!

Post new comment