Mailboxes can be exported and imported quickly and easily with the Exchange Management Shell.
First, we need authorization to import and export mailboxes, which is done with the following command
New-ManagementRoleAssignment –Role „Mailbox Import Export“ –User „administrator“
Nachdem der Befehl ausgeführt wurde, besitzt der Benutzer „Administrator“ die Berechtigungen für den Im- und Export.
Importing a PST file
An existing PST file can be imported with the following command
New-MailboxImportRequest -Mailbox Frank -FilePath \\FWEX01\c$\PST\frank.pst
Please note that a share must be specified after the -FilePath parameter. A local path does not work. The alias of the target mailbox is written after the -Mailbox parameter.
After the command has been confirmed, a new import request is created. You can view the status of the import with
Get-MailboxImportRequest
can be displayed.
If you want to import several mailboxes, you can use this command:
Dir \\FWEX01\c$\PST\*.pst | %{ New-MailboxImportRequest -Mailbox $_.BaseName -FilePath $_.FullName}
Die PST Dateien müssen dabei den gleichen Namen haben wie die Postfächer in die sie importiert werden sollen. Ist also der Alias einen Benutzers „Frank“ dann muss die dazugehörige PST-Datei „Frank.pst“ heißen.
Export to a PST file
If you want to export a mailbox again, you can do this with this command
New-MailboxExportRequest -Mailbox frank -FilePath \\FWEX01\c$\PST\frank.pst
Again, it is important to note that there must be no local path specification after -FilePath.
The status of the export can also be displayed here:
Get-MailboxExportRequest
The following command can be used to export all mailboxes in the database
(Get-Mailbox) | foreach {New-MailboxExportRequest -Mailbox $_.alias -FilePath „\\FWEX01\c$\pst\$_.pst“}
Delete import and export requests
After a mailbox has been exported or imported, the requests remain, further import or export attempts may then fail. Here we see all export requests for the Frank mailbox, 2 of which have failed:
To delete an import or export request, you need a little more detailed information, all data for the request can be deleted with
Get-MailboxExportRequest | format-list
Or.
Get-MailboxImportRequest | format-list
display.
Um einen Request zu löschen wird allerdings nur der Wert bei „Identity“ benötigt. Um die Ausgabe etwas abzukürzen, kann man den Befehl verfeinern:
Get-MailboxExportRequest | fl mailbox,identity
Or.
Get-MailboxImportRequest | fl mailbox,identity
To delete the request, use the following commands:
Remove-MailboxExportRequest -Identity „frankysweb.local/Users/Frank Zöchling\MailboxExport3“
Or
Remove-MailboxImportRequest -Identity „frankysweb.local/Users/Frank Zöchling\MailboxImport3“
Further information and parameters for the import and export request
All parameters for the export can be found here:
http://technet.microsoft.com/en-us/library/ff607299.aspx
The parameters for the import can be found here:
http://technet.microsoft.com/de-de/library/ff607310.aspx