Posted in
Windows Powershell |
4 Comments | 23,130 views | 27/03/2013 11:03
When you remove an Exchange Mailbox from DAG or your environment, msExchHomeServerName attribute remains same. You may get problem when you try to update user mailbox due to non exist Mailbox Server. In order to achieve this problem, you should get affected mailboxes first, then you should update them with correct mailbox server name.
First get all affected mailboxes:
$Mailboxes = Get-Mailbox -ResultSize Unlimited | where {$_.Servername -eq "Old_Mailbox_Name"} |
$Mailboxes = Get-Mailbox -ResultSize Unlimited | where {$_.Servername -eq "Old_Mailbox_Name"}
Update them with this:
1
2
3
4
5
6
7
| foreach ($Mailbox in $Mailboxes)
{
Write-Host $Mailbox.Name
$MBX = $null;
$MBX = Get-Mailbox -Identity $Mailbox
Set-Mailbox $MBX -Database $MBX.Database -Confirm:$false -Force -Verbose
} |
foreach ($Mailbox in $Mailboxes)
{
Write-Host $Mailbox.Name
$MBX = $null;
$MBX = Get-Mailbox -Identity $Mailbox
Set-Mailbox $MBX -Database $MBX.Database -Confirm:$false -Force -Verbose
}
After that process, all msExchHomeServerName will be corrected.