WARNING: Database is mandatory on UserMailbox

You are here:
< Back

I was presented with a troubleshooting issue today that involved PowerShell and Exchange.  The user wanted to get statistics for the mailboxes in the Exchange environment.  The problem actually ended up being 2 different changes.

First, the PowerShell command had some invalid syntax in it.  Below is the full command.

Get-Mailbox | Get-MailboxStatistics -Server [EXCHANGESERVERANME] | where {$_.ObjectClass –eq "Mailbox"} | Sort-Object TotalItemSize –Descending | ft @{label="User";expression={$_.DisplayName}},@{label="Total Size (MB)";expression={$_.TotalItemSize.Value.ToMB()}},@{label="Items";expression={$_.ItemCount}},@{label="Storage Limit";expression={$_.StorageLimitStatus}} -auto >MBSTATS.TXT

The problem with this syntax is found in the Get-MailboxStatistics section.  The parameter “-Server [EXCHANGESERVERNAME]” was causing every mailbox to return an error.  When this part of the command is removed, the command executes successfully, however, the following is displayed on the screen.

Legacy Mailbox Error Message

This warning was a result of a mailbox that was not accessible.  In this case the mailbox name was SMEX_PPMKEEX2_MB.  When reviewing the mailbox, it was discovered that the mailbox didn’t appear to have all the required attributes.  Further confusion ensued when the required attributes were not able to be added.  After a long discussion with the client, it was determined that this mailbox was not in use and was no longer required.  I disabled the mailbox (recovery is still possible during the retention policy time frame this way) and   ran the script again.  This time everything came back clean with the only warnings being that a handful of mailboxes had never been accessed since part of the command was looking at Last Logon Times.

Another important thing to note with this engagement was what the Storage Limit Status response for each mailbox really indicates.  If NoChecking is returned the mailbox does not have a size limit restriction set on it.  If BelowLimit is returned, this means that the mailbox has a limit set on it, but it has not been reached yet.  It is important to remember that mailbox size limits can be set on an entire mailbox database, or individual mailboxes.  Strange results might be returned when querying the mailbox properties if the wrong syntax is used.  Typing one thing will return no limit while typing another query will return the size limit restrictions.

Last Updated On October 24, 2017