Exchange Server

Exchange Server 2010 SP1 ile Exporting ve Importing Mailboxes İşlemleri

Bu yazımda sizlerle Exchange 2010 Sp1 üzerinde mailbox Export – Import işlemlerini paylaşacağım. Neden mailbox’ları export – import etmeye ihtiyaç duyarız. Basit bir örnek vermek gerekirse , acil durumlarda backup , restore vb. işlemler için bu işlemden yararlanabiliriz.

·         Kullanıcı mailbox’ını başka bir sunucuya migrate etmek için’de bu yöntem kullanılabilir.

·         Mevcut posta kutularında oluşan sorunlarda kullanabiliriz.

·         Mailbox Database’de oluşan hatalar’da bu işlemden yararlanabiliriz.

·         Ve üstte’de belirttiğim gibi Manual Yedekleme olarak’da tercih edebiliriz.

Bu işlemleri yapabilmemiz için aşağıda belirttiğim Prerequisites’lerin hazır olması gerekmektedir.

·         Windows 2008 r2 (önerilir) x64 işletim sistemi

·         PowerShell 2.0

·         .NetFramework 3.5.1

·         Microsoft Outlook 2010 x64

·         Exchange 2010 Management Tools

·         Sunucu üzerinde Administrator yetkisinde bir user

Yukarıda belirttiğim hususlar hazır ise işlemlerimize başlıyoruz.

C: altında Exports adında bir klasör oluşturdum. Security sekmesinden  Exchange Trusted Subsystem read/write permission yetkisi verdim ve shareettim.

İlk önce aşağıda ki komut’u Exchange Management Shell üzerinde çalıştırmamız gerekmektedir.

Bu komut ise Export – Import yapılaması istenen mailbox’lara izin verir.

New-ManagementRoleAssignment –Role “Mailbox Import Export” –User ufuk.tatlidil

image001

Şimdi Export işlemine başlayalım.
Komutumuz;

New-MailboxExportRequest -Mailbox ufuk.tatlidil -FilePath \dcExportsufuk.tatlidil.pst

image002

C: altında ki Exports klasörümüze bakalım.  .pst dosyamış oluşmuş mu diye..

image003

Get-MailboxExportRequest | Get-MailboxExportRequestStatistics

image004

Başarılı bir şekilde pst’mizi export ettik.

Yukarıda belirttiğim komutları PowerShell ‘de çalıştırırsanız , Shell ortamında Export-Import işlemlerini yapabilirsiniz.

Aynı işlemleri ECM altında Recipient Configuration – Mailbox ‘da bulunan user’ın üzerinde’de yapabilirsiniz.

image005

image006

image007

Bir script yardımı ile bu işlemi’de gerçekleştirebilirsiniz.

# Exchange 2010 SP1 Mailbox Export Script

###############

# Settings    #

###############

# Pick ONE of the two below. If you choose both, it will use $Server.

$Server = “server”

$Database = “”

# Share to export mailboxes to. Needs R/W by Exchange Trusted Subsystem

# Must be a UNC path as this is run by the CAS MRS service.

$ExportShare = “\servershare”

# After each run a report of the exports can be dropped into the directory specified below. (The user that runs this script needs access to this share)

# Must be a UNC path or the full path of a local directory.

$ReportShare = “\servershare”

# Shall we remove the PST file, if it exists beforehand? (The user that runs this script needs access to the $ExportShare share)

# Valid values: $true or $false

$RemovePSTBeforeExport = $false

###############

# Code        #

###############

if ($Server)

{

if (!(Get-ExchangeServer $Server -ErrorAction SilentlyContinue))

{

throw “Exchange Server $Server not found”;

}

if (!(Get-MailboxDatabase -Server $Server -ErrorAction SilentlyContinue))

{

throw “Exchange Server $Server does not have mailbox databases”;

}

$Mailboxes = Get-Mailbox -Server $Server -ResultSize Unlimited

} elseif ($Database) {

if (!(Get-MailboxDatabase $Database -ErrorAction SilentlyContinue))

{

throw “Mailbox database $Database not found”

}

$Mailboxes = Get-Mailbox -Database $Database

}

if (!$Mailboxes)

{

throw “No mailboxes found on $Server”

}

if (!$Mailboxes.Count)

{

throw “This script does not support a single mailbox export.”

}

# Pre-checks done

# Make batch name

$date=Get-Date

$BatchName = “Export_$($date.Year)-$($date.Month)-$($date.Day)_$($date.Hour)-$($date.Minute)-$($date.Second)”

Write-Output “Queuing $($Mailboxes.Count) mailboxes as batch ‘$($BatchName)'”

# Queue all mailbox export requests

foreach ($Mailbox in $Mailboxes)

{

if ($RemovePSTBeforeExport -eq $true -and (Get-Item “$($ExportShare)$($Mailbox.Alias).PST” -ErrorAction SilentlyContinue))

{

Remove-Item “$($ExportShare)$($Mailbox.Alias).PST” -Confirm:$false

}

New-MailboxExportRequest -BatchName $BatchName -Mailbox $Mailbox.Alias -FilePath “$($ExportShare)$($Mailbox.Alias).PST”

}

Write-Output “Waiting for batch to complete”

# Wait for mailbox export requests to complete

while ((Get-MailboxExportRequest -BatchName $BatchName | Where {$_.Status -eq “Queued” -or $_.Status -eq “InProgress”}))

{

sleep 60

}

# Write reports if required

if ($ReportShare)

{

Write-Output “Writing reports to $($ReportShare)”

$Completed = Get-MailboxExportRequest -BatchName $BatchName | Where {$_.Status -eq “Completed”} | Get-MailboxExportRequestStatistics | Format-List

if ($Completed)

{

$Completed | Out-File -FilePath “$($ReportShare)$($BatchName)_Completed.txt”

}

$Incomplete = Get-MailboxExportRequest -BatchName $BatchName | Where {$_.Status -ne “Completed”} | Get-MailboxExportRequestStatistics | Format-List

if ($Incomplete)

{

$Incomplete | Out-File -FilePath “$($ReportShare)$($BatchName)_Incomplete_Report.txt”

}

}

# Remove Requests

Write-Output “Removing requests created as part of batch ‘$($BatchName)'”

Get-MailboxExportRequest -BatchName $BatchName | Remove-MailboxExportRequest -Confirm:$false

Bu işlemlerden sonra export ettiğiniz pst dosyasını başka bir Ms Outlook’a import edebilir veya backup olarak tutabilirsiniz.

 

İlgili Makaleler

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir

Başa dön tuşu