User Tools

Site Tools


Hier findet ihr ein Script um das exportierte pst File eines Accounts in eine Mailbox zu importieren. Der Account wird abgefragt und der Mailboximportjob gestartet und überwacht bis er fertig ist und der verbliebene Job wird vom Exchangesystem gelöscht.

This is a simple Powershell script to import an recently exported Mailbox
The script will first export the Mailbox from a selected old Account to a Networkdrive
and the Import it to the Users new Account, so the User will have it´s old Mails in his new Account.
You have to enter the UserID to exported first
Then enter the UserID of Account in wich to Import it.
$User1 = Read-Host -Prompt 'UserID of Account that was exported'
$User2 = Read-Host -Prompt 'UserID of Account to be imported'
$date = (Get-Date).ToString("_yyyyMMdd")
$Servername = "Name des Quellservers"
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
#Defining Source and Destination path
$DestPath = "\\$Servername\UserExport$\$date\$User1"
#$Mailbox = (get-aduser $User1 -Properties CanonicalName).CanonicalName
$Mailbox2 = (get-aduser $User2 -Properties CanonicalName).CanonicalName
New-MailboxImportRequest -FilePath "$DestPath\mailboxexport_$User1.pst" -Mailbox $User2
# -TargetRootFolder "$User2"
Write-Host "Mailboximport is getting done from File: "$DestPath\mailboxexport_$user1.pst" to Mailbox $User2" -foreground "yellow"
if ($Time) {clear-variable -name Time}
$Time = (Get-Date).ToLongTimeString()
	$checkcompleted = Get-MailboxImportRequest -Mailbox $Mailbox2 -Status completed
	start-sleep -s 10
                Write-Host "Import is still running" -foreground "yellow"
Write-Host "Mailboximport is done to Mailbox $User2" -foreground "green"
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
import_einer_mailbox.txt · Last modified: 2017/01/17 10:43 by clemens