Installing Exchange 2010 Service Pack 1 Fails At Mailbox Role: Database is mandatory on UserMailbox.

In a recent inci­dent, an Exchange serv­er had a com­plete vol­ume fail­ure dur­ing test­ing. Exchange 2010 was rein­stalled but when installing Ser­vice Pack 1, it failed upgrad­ing the Mail­box Role. Upon review­ing the log, I found the fol­low­ing line:

Database is mandatory on UserMailbox. Property Name: Database

The error does­n’t explain the prob­lem very well but it is basi­cal­ly say­ing that there is a User­Mail­box with­out a data­base, which should nev­er hap­pen. The fail­ure of the vol­ume and sub­se­quent rein­stall of 2010 left the arbi­tra­tion mail­box­es (and one or two user mail­box­es) orphaned. Most of the sug­ges­tions to resolve this prob­lem list doing things like delet­ing the sys­tem mail­box­es and run­ning “setup.com /PrepareAD”. After look­ing around, I was able to parse togeth­er a few oth­er options and find a fix.

First, do a search in AD for the Sys­tem mail­box­es and make sure they exist in AD. (If they do not exist, check out this blog.)The three mail­box­es are:

  • Dis­cov­ery - SystemMailbox{e0dc1c29-89c3-4034-b678-e6c29d823ed9}
  • Mes­sage Approval - SystemMailbox{1f05a927-xxxx-xxxx-xxxx-xxxxxxxxxxxx} (where x is a ran­dom num­ber)
  • Fed­er­at­ed E-mail - FederatedEmail.4c1f4d8b-8179-4148-93bf-00a95fa1e042

Next, check out the sta­tus of their mail­box­es:

Get-Mailbox –Arbitration

For this client, their Dis­cov­ery and Mes­sage Approval mail­box­es spat out error mes­sages:

WARNING: The object XXXXXXXX.XXXXX/Users/SystemMailbox{e0dc1c29-89c3-4034-b678-e6c29d823ed9} 
has been corrupted, and it's in an inconsistent state. The following validation errors happened:
WARNING: Database is mandatory on UserMailbox.

The fix is a love­ly, one-line pow­er­shell. It won’t do any­thing with­out prompt­ing you first. To ver­i­fy it fix­es the issue after you run it, take the first half of the com­mand (get-mail­box -arbi­tra­tion) and run that again to con­firm they are online and okay.

Get-Mailbox -Arbitration | Set-Mailbox -Arbitration –Database "Mailbox Database XXX"

Hope­ful­ly this saves some­body from caus­ing a big­ger mess than nec­es­sary. After run­ning this, I was able to install Ser­vice Pack 1 just fine. YMMV.

Edit: I found the DiscoverySearchMailbox{D919BA05-46A6-415f-80AD-7E09334BB852} was orphaned as well. To fix this mail­box, I just ran the fol­low­ing PoSH.

Get-Mailbox -Identity "DiscoverySearchMailbox{D919BA05-46A6-415f-80AD-7E09334BB852}" | Set-Mailbox –Database "Mailbox Database XXX"

Exchange 2007+: Aliases have invalid data

Twice in the past two weeks, I have come across Exchange 2003 to Exchange 2007 migra­tions which went uncom­plet­ed. In both cas­es, I received the fol­low­ing error(s) when try­ing to view the prop­er­ties of a recip­i­ent with spaces in its alias or when view­ing the prop­er­ties of the offline address book:

  • The prop­er­ties on have invalid data. If you click OK, default val­ues will be used instead and will be saved if you do not change them before hit­ting Apply or OK on the prop­er­ty page. If you click can­cel, the object will be dis­played read-only and cor­rupt­ed val­ues will be retained. The fol­low­ing val­ues have invalid data: Alias.
  • WARNING: Object has been cor­rupt­ed and it is in an incon­sis­tent state. The fol­low­ing val­i­da­tion errors have been encoun­tered: WARNING: is not valid for Alias.
  • Set- : is not valid for Alias.

Here is a screen­shot of the error:

Exchange 2003 would allow an admin­is­tra­tor to put spaces in the Alias attribute. That pos­es a prob­lem for 2007 which is strict about the char­ac­ters it allows in this attribute. In Exchange 2007 the fol­low­ing char­ac­ters are con­sid­ered valid: Strings formed with char­ac­ters from a to z (upper­case or low­er­case), dig­its from 0 to 9, !, #, $, %, &, ‘, *, +, -, /, =, ?, ^, _, ‘, {, |, } or ~. But, no spaces.

Going through you recip­i­ents one by one is a daunt­ing task. Here is some code to auto­mate this cleanup. Once you take care of this, you should­n’t run into it again since the tools in Exchange 2007 won’t let you make the same mis­take.

Clean up mail­box­es:

Get-Mailbox | Where {$_.Alias -like "* *"} | ForEach-Object {Set-Mailbox $_.Name -Alias:($_.Alias -Replace " ","")}

Clean up pub­lic fold­ers:

Get-PublicFolder | Where {$_.Alias -like "* *"} | ForEach-Object {Set-PublicFolder $_.Name -Alias:($_.Alias -Replace " ","")}
Get-PublicFolder -Identity "" -Recurse -ResultSize Unlimited | Foreach { Set-PublicFolder -Identity $_.Identity -Name $_.Name.Trim()}

Clean up con­tact objects:

Get-MailContact -ResultSize unlimited | foreach {$_.alias = $_.alias -replace 's|,|.'; $_} | Set-MailContact
Get-Contact | Where {$_.Alias -like "* *"} | ForEach-Object {Set-Contact $_.Name -Alias:($_.Alias -Replace " ","")}

Clean up dis­tri­b­u­tion groups:

Get-DistributionGroup | Where {$_.Alias -like "* *"} | ForEach-Object {Set-DistributionGroup $_.Name -Alias:($_.Alias -Replace " ","")}

Check for any objects that still throw errors:

Get-PublicFolder | findstr "Warning"
Get-Contact -resultsize unlimited | findstr "Warning"
Get-Mailbox -resultsize unlimited | findstr "Warning"
Get-DistributionGroup -resultsize unlimited | findstr "Warning"

Rebuild your address lists:

Set-AddressList "All Users" -IncludedRecipients MailboxUsers
Set-AddressList "All Groups" -IncludedRecipients Mailgroups
Set-AddressList "All Contacts" -IncludedRecipients MailContacts
Set-AddressList "Public Folders" -RecipientFilter {RecipientType -eq "PublicFolder"}
Set-GlobalAddressList "Default Global Address List" -RecipientFilter {(Alias -ne $null -and (ObjectClass -eq 'user' -or ObjectClass -eq 'contact' -or ObjectClass -eq 'msExchSystemMailbox' -or ObjectClass -eq 'msExchDynamicDistributionList' -or ObjectClass -eq 'group' -or ObjectClass -eq 'publicFolder'))}