若要将已删除的邮箱连接到用户帐户,该帐户必须存在, 并且 RecipientType 属性的值必须是 User,这表示该帐户尚未启用邮箱。参因为是删除邮箱一并删除的Ad账户,所以需要新建一个AD 账户来连接要恢复的邮箱。
注:在连接删除的链接邮箱、资源邮箱或共享邮箱时,要将邮箱连接到的 Active Directory 用户帐户必须处于禁用状态。
实验步骤如下 :
- 删除邮箱 demo01
- Remove-Mailbox -Identity demo01 -Confirm:$false
- 查询 AD 账户已经一并删除
- Get-User -Identity demo01
- Get-ADUser -Identity demo01
- 刷新数据库
- Get-MailboxStatistics -Database DB1603 | Where { $_.DisconnectReason -ne $null } | ForEach { Update-StoreMailboxState -Database $_.Database -Identity $_.MailboxGuid -Confirm:$false }
- 再次验证删除的邮箱状态
- Get-MailboxDatabase | foreach {Get-MailboxStatistics -Database $_.name} | where {$_.DisplayName -eq “demo01”} | Format-List DisplayName,Database,DisconnectReason
- 新建用户demo01
- $splat = @{
- Name = ‘Demo01’
- AccountPassword = (Read-Host -AsSecureString ‘AccountPassword’)
- Enabled = $true
- }
- New-ADUser @splat
- 连接邮箱 后,之前的邮件并没有被删除
- Connect-Mailbox -Identity Demo01 -Database DB1603 -User Demon01
- Get-User -Identity demon01