刷新已禁用用户邮箱状态

Get-MailboxDatabase | Get-MailboxStatistics | Where { $_.DisplayName -eq "白娟" } | select -Property *
Update-StoreMailboxState -Database  MB-FSLubao03 -Identity   0548a52c-6147-4f87-aea1-b42ac3029925

当用户邮箱被禁用后,需要过一段时间该用户邮箱才会出现在“已断开连接”的邮箱中,默认EX最长刷新周期为24小时,通过下面命令可以强制刷新该用户邮箱状态,之后就可以在EXchange管理页面重新链接该邮箱。

$displayname = "张三"
$w=get-MailboxDatabase | Get-MailboxStatistics | Where { $_.DisplayName -eq $displayname }
$w.database
$w.MailboxGuid
#先确认是否有重名

Update-StoreMailboxState -Database $w.database -Identity $w.MailboxGuid
get-MailboxDatabase | Get-MailboxStatistics | Where { $_.DisplayName -eq $displayname }|select disconnectdate,disconnectreason

#下面命令刷新该邮箱数据库中所有用户邮箱状态

Get-MailboxStatistics -Database MXDB-NanQu | foreach {Update-StoreMailboxState -Database $_.Database -Identity $_.MailboxGuid -Confirm:$False}

#当用户邮箱已被禁用,其disconnectreason为空,可以直接链接邮箱(未测试)

Get-MailboxDatabase -Identity "Databasename"  | Get-MailboxStatistics | Where { $_.Displayname -eq "Display Name" } | Connect-Mailbox -User "Userid" 

==============================================================

本示例将连接链接的邮箱。Identity 参数指定 Exchange 数据库中断开连接的邮箱。 LinkedMasterAccount 参数指定帐户林中要将邮箱重新连接到的 Active Directory 用户帐户。 Alias 参数指定重新连接的邮箱的别名;别名是电子邮件地址中 @ 符号左侧的部分。

Connect-Mailbox -Identity "Kai Axford" -Database MBXDB02 -LinkedDomainController FabrikamDC01 -LinkedMasterAccount kai.axford@fabrikam.com -Alias kaia


此示例将连接用户邮箱。Identity 参数指定 Exchange 数据库中断开连接的邮箱。 User 参数指定要将邮箱重新连接到的 Active Directory 用户帐户。

Connect-Mailbox -Identity "Jeffrey Zeng" -Database MBXDB01 -User "Jeffrey Zeng"


原文地址:https://www.cnblogs.com/dreamer-fish/p/4648357.html