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"
Once the command has been executed, the "Administrator" user has the import and export authorizations.
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}
The PST files must have the same name as the mailboxes into which they are to be imported. So if the alias of a user is "Frank", the corresponding PST file must be named "Frank.pst".
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.
However, only the value for "Identity" is required to delete a request. To shorten the output somewhat, you can refine the command:
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
Hallo ihr Meister eures Fachs!
Ich versuche bei Exchange 2010 aus einem Postfach alle Elemente (also auch in Unterordnern etc) wegzusichern die älter als 01.01.2016 sind. Irgendwie will es nicht klappen. Hat wer eine Idee?
Ich bekomme folgende Fehlermeldung:
Die Benennung „New-MailboxExportRequest“ wurde nicht als Name eines Cmdlet, einer Funktion, einer Skriptdatei oder eine
s ausführbaren Programms erkannt. Überprüfen Sie die Schreibweise des Namens, oder ob der Pfad korrekt ist (sofern enth
alten), und wiederholen Sie den Vorgang.
Bei Zeile:1 Zeichen:25
+ New-MailboxExportRequest <<<< -Mailbox helmut -FilePath \\SERVER2008\Daten\helmut.pst
+ CategoryInfo : ObjectNotFound: (New-MailboxExportRequest:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Keine Ahnung wo jetzt der Fehler steckt.
Hi Andres,
hast du dem Benutzer die entsprechenden Rechte zum Export gegeben? („New-ManagementRoleAssignment…“)
Nach dem Zuweisen der RBAC Rolle musst die Exchange Shell einmal schließen und neu öffnen.
Gruß, Frank
Shell schließen und öffnen, das war die Lösung.
:) vielen, vielen Dank.
Hallo Neo,
der Befehl sollte so aussehen:
New-MailboxExportRequest -Mailbox „Mueller, Max“ -FilePath \\Mailserver\Freigabe$\PST\“Mueller, Max“.pst
Hi Neo,
hast Du vorher den Administrator berechtigt damit er den Export ausführen darf?
VG Michael
Hi Sebastian,
du erstellst eine PS1 Datei darin sollte folgendes stehen:
Get-MailboxExportRequest -Status Completed | Remove-MailboxExportRequest -confirm:$all
dies kannst Du mit einem Task verbinden, der nach dem export der PST ausgeführt wird.
Viele Grüße
Michael
Hi Neo,
welchen Befehl führst du aus? kann es sein das ein Anführungszeichen fehlt?`
Gruss,
Frank
Hallo, bei mir zeigt das Ausführen des Exportbefehls (New-MailboxExportRequest) keinerlei Wirkung. Der Kursor springt einfach nur in die nächste Zeile [ >>_ ] … und nix passiert. Das Setzen der Import/Export-Berechtigung funktioniert (scheinbar).
Kann mir bitte jemand sagen, was ich ggf. falsch mache?
Danke und viele Grüße
Neo2001
Danke für die Info,
aber es ist der Get-MailboxExportRequest der ausgeführt werden muss.
kompletter Befehl ist:
Get-MailboxExportRequest -Status Completed | Remove-MailboxExportRequest -Confirm:$false
danach ist die Queue wieder komplett gelöscht
Hi,
oh ich wusste garnicht das -confirm eine Paramter akzeptiert. Vielen Dank für die Rückmeldung :-)
Gruß Frank
Hi,
ich mal wieder ;-)
kann man den Remove-MailboxImportRequest auch automatisieren?
Ich lasse die PST jede Nacht automatisch erstellen.
Leider ist irgendwann die Queue voll und ich muss sie mit dem Removebefehl löschen. Leider macht er das nicht automatisch da ich immer das Löschen bestätigen muss.
Geht das auch anders?
Gruß Sebastian
Schau mal hier:
http://social.technet.microsoft.com/Forums/hu/exchange2010/thread/7eb75b62-b928-4f14-932c-9d7e236f46ee