Skip to content

Instantly share code, notes, and snippets.

@maestropanel2
Created November 14, 2015 12:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save maestropanel2/5e065042939b2e5ed875 to your computer and use it in GitHub Desktop.
Save maestropanel2/5e065042939b2e5ed875 to your computer and use it in GitHub Desktop.
Exchange Server 2013 Restore Recovery Mailbox Database Script
<#
.SYNOPSIS
Bu script Recovery Mailbox Database'indeki mailbox'lara göre yeni kullanıcı oluşturur ve Restore isteği gönderir.
.DESCRIPTION
Başka bir sunucu üzerinden kurtarılmış ve yeni bir sunucuya Mount edilmiş Mailbox Database içindeki kullanıcı tipindeki Mailbox'ları listeler ve bunlara göre aktif Veritabanı üzerinde kullanıcılar oluşturur. Oluşturulan kullanıcılar için eski veritabanından Restore isteği gönderir.
.NOTES
File Name : ResoteRecoveryDB.ps1
Author : Oğuzhan YILMAZ (oguzhan@maestropanel.com)
Prerequisite : Exchange Server 2013
.LINK
http://wiki.maestropanel.com
#>
$RecoveryDatabaseName = "RecoveryDB" #Veritabanının İsmi
$TempPassword = Read-Host "makara24!" -AsSecureString #Geçici parola, Kullanıcı açmak için
$UPNSuffix = "salla.com"; #Sunucu üzerindeki geçerli suffix
foreach($ritem in Get-MailboxStatistics -Database $RecoveryDatabaseName | ?{($_.DisplayName -notlike "*HealthMailbox*") -AND ($_.DisplayName -notlike "*Microsoft*") -AND ($_.DisplayName -notlike "*SystemMailbox*") -AND ($_.DisplayName -ne "Administrator")}) {
New-Mailbox -DisplayName $ritem.DisplayName -Name $ritem.DisplayName -Password $TempPassword -UserPrincipalName "$($ritem.Identity)@$($UPNSuffix)"
New-MailboxRestoreRequest -SourceDatabase RecoveryDB -SourceStoreMailbox $ritem.Identity -TargetMailbox $ritem.DisplayName -AllowLegacyDNMismatch
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment