Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Importing and Exporting Mailboxes to PST Files

Management With PowerShell

Importing and Exporting Mailboxes to PST Files

by  markdmac  Posted    (Edited  )
[blue]Exchange 2007 Mailbox Management With PowerShell
By Mark D. MacLachlan (markdmac)
[/blue]

This FAQ will discuss scenarios where it may be necessary to import or export mailboxes to PST files and will present steps to achieve that goal.

Migrating from Exchange 2003

Chances are that you are migrating from Exchange 2003 to Exchange 2007. Under most circumstances you will use the Move Mailbox feature to move your mailboxes over. There are times however when you may prefer to start fresh.

This can especially be the case when migrating from SBS 2003 to SBS 2008 since SBS does not support the use of the domain rename tool. Small businesses, particularly law firms or doctor offices may have changed partners and consequently wish to change their internal domain names. A fresh install is the only way to accomplish this.

You may have Active Directory problems that you don't want to migrate over to your new domain.

And finally you may be looking at a situation where your company has merged with another company.

In any of the above cases, use ExMerge on the Exchange 2003 server to export mailboxes en-mas to PST.

[blue]On to Exchange 2007.....[/blue]
OK, now you are either doing a fresh install of Exchange 2007 or have migrated from Exchange 2003. Either way you are now ready to dive into using PowerShell to manage your new Exchange Server.

Importing Mailboxes With PowerShell

You can use PowerShell to import the PST files into existing mailboxes. If you have not done so already, you will need to create mailboxes ahead of time.

Setting Up The Workstation To Import PST Files
Unlike Exchange 2003, there isn't a GUI interface to import and export mailboxes. Microsoft really did the IT Community a disservice in my opinion. Here you have a new x64 server and are required to use an x86 client to manage it. Yes, you read right, you need to set up an x86 client to get this job done.

1. You need an x86 OS (XP, 2003 or Vista)
2. Install Outlook 2003 or 2007
3. Install PowerShell 1.0
4. Install Exchange Tools using the free x86 download of Exchange 2007 from Microsoft.com.
http://www.microsoft.com/downloads/details.aspx?FamilyID=6be38633-7248-4532-929b-76e9c677e802&displaylang=en
5. Install any Exchange Service Packs or Roll Up packages that are installed on the server to ensure the workstation matches the server version.
At the time of this writing, RUP 8 is the most current.
http://www.microsoft.com/downloads/details.aspx?familyid=E1F5C8B2-C4F2-4EBA-849B-E464D4F2869C&displaylang=en
6. The user running the task must be an Exchange Organization Admin or an Exchange Server Admin on the server where the mailbox to export/import lives.

For ongoing maintenance and the ability to export mailboxes, I recommend you use a virtual machine on the server for this task so you don't have to tie up a workstation.

Performing the Import
You are now ready to execute the PowerShell command to import the PST files. The following command will loop through all existing mailboxes and look for a PST to import. If none is found that mailbox is simply skipped. You need to replace the text in [red]red[/red] with your database name and the appropriate path to the PST files.
Code:
Get-Mailbox -Database '[red]MDB[/red]' | Import-Mailbox -PSTFolderPath [red]D:\PSTs[/red]

If you just want to import a specific mailbox, you can do that too.

Code:
Import-Mailbox ûIdentity [red]<mailboxUser>[/red] -PSTFolderPath [red]<pathToSavePST>[/red]

Exporting Mailboxes to PST
Every business has employee turnover. You will no doubt want to have the ability to export mailboxes to PST before you delete the accounts to free up a user CAL. PowerShell allows you to do this.

The most basic cmdlet to export a mailbox to a PST file follows, as before you must replace the text in [red]red[/red] with appropriate data for your network:

Code:
Export-Mailbox ûIdentity [red]<mailboxUser>[/red] -PSTFolderPath [red]<pathToSavePST>[/red]

To export all users you can use the following cmdlet.

Code:
Get-Mailbox -Database '[red]MDB[/red]' | Export-Mailbox -PSTFolderPath [red]D:\PSTs[/red]

I hope you have found this FAQ useful. If you have, please rate it.
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top