‘Failed to find the mailbox’ error when running Test-OutlookWebServices

When running Test-OutlookWebServices from the Exchange Management Shell (EMS) to test autodiscover services, it is possible to receive the following error…

[PS] C:\>Test-OutlookWebServices -TargetAddress emailuser@domain1.com | fl
WARNING: An unexpected error has occurred and a Watson dump is being generated: Failed to find the mailbox. Mailbox = 'extest_0218acace9d94@domain1.local'.
Failed to find the mailbox. Mailbox = 'extest_0218acace9d94@domain1.local'.
  + CategoryInfo          : NotSpecified: (:) [Test-OutlookWebServices], MailboxNotFoundException
  + FullyQualifiedErrorId : Microsoft.Exchange.Monitoring.MailboxNotFoundException,Microsoft.Exchange.Management.SystemConfigurationTasks.TestOutlookWebServicesTask

This error occurs because the account/mailbox autodiscover uses to perform tests either doesn’t exist in AD or doesn’t have a mailbox enabled for it.

To fix the error, we must create the “extest_…” account and/or enable the mailbox. Luckily, the Exchange team has provided a script for use to automate this task. I’ve had two different situations in which this error occurred:

  1. The account needed to be created in AD and a mailbox enabled for it; and
  2. The account existed but the mailbox did not.

When neither the test account or mailbox exists…

In EMS, traverse to the Exchange scripts folder (C:\Program Files\Microsoft\Exchange Server\V15\Scripts) and run the following command…

Get-MailboxServer | .\New-TestCasConnectivityUser.ps1

You will be prompted to enter a temporary secure password for the test account to complete its creation…

Please enter a temporary secure password for creating test users. For security purposes, the password will be changed regularly and automatically by the system.
Enter password: *********

If you have multiple Exchange servers, the script will run until it creates the account and mailbox on the server the command is being run from.

Create test user on: EX1.domain1.local
Click CTRL+Break to quit or click Enter to continue.:

CreateTestUser : Mailbox could not be created. Verify that OU ( Users ) exists and that password meets complexity requirements.
At C:\Program Files\Microsoft\Exchange Server\V15\Scripts\new-TestCasConnectivityUser.ps1:255 char:13
+   $result = CreateTestUser $exchangeServer $mailboxServer $securePassword $Organ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,CreateTestUser

Create test user on: EX2.domain1.local
Click CTRL+Break to quit or click Enter to continue.:

CreateTestUser : Mailbox could not be created. Verify that OU ( Users ) exists and that password meets complexity requirements.
At C:\Program Files\Microsoft\Exchange Server\V15\Scripts\new-TestCasConnectivityUser.ps1:255 char:13
+   $result = CreateTestUser $exchangeServer $mailboxServer $securePassword $Organ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,CreateTestUser

Create test user on: EX3.domain1.local
Click CTRL+Break to quit or click Enter to continue.:

UserPrincipalName: extest_32ed8edb18354@domain1.local
WARNING: The command completed successfully but no settings of 'domain1.local/Users/extest_32ed8edb18354' have been modified.

You can enable the test user for Unified Messaging by running this command with the following optional parameters : [-UMDialPlan  -UMExtension ]. Either None or Both must be present.

When the command completes, confirm the account has been created in the default ‘Users’ container via ADUC (i.e. extest_…) and there is a mailbox present for that account in Exchange, too.

At last, you should now be able to run the original Test-OutlookWebServices command successfully.

When the test account exists but mailbox does not…

In the situation where the test account exists but the mailbox does not, running the “Get-MailboxServer | .\New-TestCasConnectivityUser.ps1” will fail.  The only way to address the error at this point is to manually enable a mailbox for the test account.

Either through the Exchange console or shell, enable a mailbox for the “extest_…” account that already exists in the ADUC ‘Users’ container.  Once the account has a mailbox, running the Test-OutlookWebServices command will be successful.

Good luck.

Reference(s):

Advertisements

3 thoughts on “‘Failed to find the mailbox’ error when running Test-OutlookWebServices

  1. This is by far the easiest way for me to re-create a test account. This error happened after my DAG copy was reseeded with -DeleteExistingFiles switch. Thanks Todd!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s