Exchange 2010: New-TestCasConnectivityUser.ps1 fails to create test user

If you haven’t created CAS connectivity test user, SCOM will fail on few tests (example: Test-OutlookConnectivity cmdlet run by SCOM action account). SCOM will complain that it can’t monitor Exchange.

Fast forward, you figured out already that you have to run New-TestCASConnectivityUser.ps1 to create test account per each database, so SCOM can do it job. Now TestCASConnectivityUser.ps1 fails with following message.

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

I found there is nothing wrong you and I are doing. It’s a built-in script we are trying to run. Users container exists every damn Active Directory. I even typed the password with correct complexity requirements one key at a time.

I found the script has a bug. you can fix it yourself. Here it is.

Open the script C:\Program Files\Microsoft\Exchange Server\V14\Scripts\new-TestCasConnectivityUser.ps1 in PowerShell ISE (or Notepad). Search for New-Mailbox (line 49 for me), see the exact line below. Remove the option -OrganizationalUnit:$OrganizationalUnit.

new-Mailbox -Name:$UserName -Alias:$UserName -UserPrincipalName:$UserPrincipalName -SamAccountName:$SamAccountName -Password:$SecurePassword -Database:$mailboxDatabaseName  -OrganizationalUnit:$OrganizationalUnit -ErrorVariable err -ErrorAction SilentlyContinue

That’s it. Now this script should run with no errors. If we don’t specify the OrganizationUnit, account will create in Computers container by default. Enjoy!! Smile

4 thoughts on “Exchange 2010: New-TestCasConnectivityUser.ps1 fails to create test user

  1. Excellent content you got here! You can earn some extra $$$ from your visitors, don’t miss this opportunity,
    for more info simply search in google – omgerido monetize website

Leave a Reply

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

You are commenting using your 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 )

Connecting to %s