کد:
http://www.msexchange.org/articles_tutorials/exchange-server-2007/management-administration/exchange-2007-sp1-mailbox-management-part1.html
Step by step instructions on how to import and export mailbox data to and from PST files using the enhanced Import-Mailbox and Export-Mailbox cmdlets in Exchange Server 2007 Service Pack 1.

One of the big disappointments with the Exchange Server 2007 RTM version was the lack of being able to export an Exchange 2007 mailbox to a personal folder (.PST) file using the Export-Mailbox cmdlet. Although the Microsoft Exchange Server 2003 Mailbox Merge Wizard (ExMerge) tool allowed us to extract mailbox data from an Exchange 2007 mailbox to a PST file, this scenario wasn’t tested and therefore not supported by Microsoft. This meant that this approach wasn’t commonly used in the Enterprise IT organizations around the world. Since we’re getting closer and closer to the release of the Exchange 2007 SP1 RTM version, I thought now was a good time to provide you with the steps necessary in order to not only export but also import data to and from PST files using the Export-Mailbox cmdlet.

Warning:
This article is based on the Exchange 2007 SP1 beta 2 version. Please bear in mind that you should never install a beta version of an Exchange 2007 Service Pack into your production environment. Doing so is not supported by Microsoft.
Exporting Exchange Server 2007 Mailbox Data to a PST File

Prerequisites
What came as a big surprise was that you can’t just log on to an Exchange 2007 64-bit server and then export the mailbox data to a PST file using the Export-Mailbox command. Actually it’s not possible to export data to a PST file from a 64-based Exchange 2007 server; you must instead run this cmdlet on a server or client with the 32-bit version of the Exchange 2007 System Management tools installed. In addition, you must install Outlook 2003 SP2 or later. Yes I’m not kidding here, and the reason why this is so is because Exchange 2007 doesn’t contain the Outlook PST provider like previous versions of Exchange Server did.
As many of you probably are aware, Microsoft doesn’t support installing the Outlook client on Exchange 2003, 2000 or 5.5 servers since the MAPI32.dlls included with Outlook and those included with Exchange aren’t compatible. But since Exchange 2007 doesn’t ship with the Outlook client binaries, installing Outlook 2003 SP2 or later on an Exchange 2007 server is supported. For additional information see Dave Goldman’s blog post on this topic here.
If you try to run Export-Mailbox –Identity ‘alias’ –PSTFolderPath <path to where PST should be created> in the Exchange Management Shell (EMS) on a 64-bit Exchange 2007 server without the Outlook client installed, you will receive the error message shown in Figure 1 below.

Figure 1: Export-Mailbox Error
Because 32-bit based Exchange 2007 servers aren’t supported in a production environment, this means that you must install the Exchange 2007 System Management Tools on either a 32-bit XP SP2/Vista client or Windows 2003/2008 server in your AD forest. Some of you might wonder how you’re going to install a 32-bit based Exchange 2007 server in your corporate production environment, when only the 64-bit version is supported. Well, actually the 32-bit version is supported in production but, and this is important, only for management purposes such as extending the AD schema/domain and for managing user and server objects etc. This section in the Exchange 2007 documentation library talks more about using the 32-bit version of the Exchange 2007 Management Tools to administer Exchange 2007.
Okay, so this means you must prepare a client or server in your environment by first installing the Exchange 2007 System Management tools and then Outlook 2003 SP2 or later. When you have done so, you can then log on to the respective client or server and open the Exchange Management Shell and type the following command to export a mailbox to a PST file:
Export-Mailbox –Identity ‘alias’ –PSTFolderPath <path to where PST should be created such as c:\PSTs\alias.pst>
When pressing Enter, you’ll be prompted to confirm that you really want to perform this action as shown in Figure 2.

Figure 2: Confirmation message asking whether we want to export the respective mailbox to a PST file
When clicking “Y” the respective mailbox will be opened and the Export-Mailbox cmdlet will start to move the content to the specified PST file (Figure 3).

Figure 3: Exporting Mailbox Data to a PST File
Note:
Exporting data from a mailbox to a PST file doesn't delete the content in the source mailbox. If you want to delete the content, you must include the -DeleteContent or-DeleteAssociatedMessages depending on whether you want to delete all mailbox data or just associated messages.
Depending on the server as well as size and number of items in the specified mailbox, the export can take a few minutes and more. When the export is completed, you can do whatever you want to do with it. Perhaps you’re doing a cross-forest transition for a relatively small organization and don’t want to set up a trust between the AD forests. Perhaps you simply want to archive this data for later use or simply just clean out a mailbox.
Note:
The user account you’re logged on with must have permissions to access the mailbox(es) that are to be exported to PST files. Instructions on how you give permissions to a mailbox or a mailbox database can be found here.
Okay, I now know how you can export a single mailbox to a PST file, but I have to do this for several thousand users. So how do you do you export mailbox data to PST files for users in bulk? That’s a very good question, which can be done using different approaches. To export data for all mailboxes in a particular mailbox database, you would need to pipe the result of a Get-Mailbox to the Export-Mailbox cmdlet. To do so enter the following command:
Get-Mailbox –Database <name of database> | Export-Mailbox –PSTFolderPath c:\PSTs
If you’d rather export mailbox data for user mailboxes in a particular Organizational Unit (OU) in your Active Directory forest, type:
Get-Mailbox -OrganizationalUnit <name of OU> | Export-Mailbox -PSTFolderPath c:\PSTs
What Mailbox Content is exported to the PST File?

By default, the following data is exported to the PST file unless specified otherwise:

  • All Custom Folders & Subfolders
  • Inbox
  • Deleted Items
  • Drafts
  • Junk E-Mail
  • Outbox
  • Sent Items
  • Journal
  • Calendar
  • Contacts
  • Notes
  • Tasks

If you want specific folders to be exported, you can do so using the -IncludeFolders and -ExcludeFolders parameters. You could also use a command that only exports all messages between two dates or messages containing specific words etc. However, these options are out of the scope of this article, but I suggest you take a look at this section in the Exchange 2007 Documentation Library for additional information.
Importing a PST File to an Exchange 2007 Mailbox

You can also import data from a PST file to an Exchange 2007 mailbox. This is done using the Import-Mailbox cmdlet. Again the same rules apply here, that is, you must run the Import-Mailbox cmdlet on a 32-bit client or server with the Exchange 2007 Management tools and Outlook 2003 SP2 or later installed.

To import a PST file called hew.pst located at C:\PSTs to an Exchange 2007 user mailbox with alias hew, run the following command (Figure 4):
Import-Mailbox –Identity hew –PSTFolderPath: c:\PSTs\hew.pst

Figure 4: Confirming we want to import a PST file to an Exchange 2007 Mailbox
After confirming you really want to do this, the messages are moved into the specified user mailbox (Figure 5).

Figure 5: Importing data from a PST file to an Exchange 2007 Mailbox
Note:
You cannot use the Import-Mailbox cmdlet to import data from a PST file to a legacy mailbox. In this specific situation, you must use the ExMerge tool. Also, you cannot import data to a mailbox in a Recovery Storage Group (RSG).
To import PST files for users in bulk, you must specify the file folder containing the PST files. For example, if you want to import PST files to user mailboxes stored in a specific mailbox database, type:
Get-Mailbox –Database <name of database> | Import-Mailbox -PSTFolderPath c:\PSTs
To do the same for users in an OU in your Active Directory Forest, use:
Get-Mailbox -OrganizationalUnit <name of OU> | Import-Mailbox -PSTFolderPath c:\PSTs


Conclusion

It’s good to finally be able to export as well as import mailbox data to and from a PST file using the Export-Mailbox and Import-Mailbox cmdlets, but personally I think it’s a disappointment that you must install Outlook 2003 SP2 or later on the respective server as well as use a 32-bit server to accomplish this, as the steps are just as cumbersome as when you export and import mailbox data using the ExMerge tool. If you have one or more dedicated Exchange 2007 management servers though, this shouldn’t really be a problem.






موضوعات مشابه: