You may experience problems performing mailbox move operations if the number of characters on a given Exchange attribute is greater than the default values defined by /SchemaPrep. Most commonly this issue occurs because of an administrative and unsupported edit of the Schema to allow for more characters to be present on a given user attribute. Afterwards when the Mailbox-Move is attempted new Move-Mailbox prevalidation logic runs and ultimately fails the move if the user has a larger number of characters present on the object than that which was defined by /SchemaPrep for the attribute. This error will only manifest itself when the source or target of a mailbox move is an Exchange 2007 mail store. When the Mailbox Move fails the following error will be displayed in the Exchange Management Console:
<Attribute Name> is too long: maximum length is "x" and the actual length is "y"
The inspiration for this post came from a real issue I troubleshoot within Exchange Escalations Support. Throughout this post, I will be referencing and providing examples based upon Exchange Custom Attribute 2 (e.g. extensionAttribute2). However a failure could occur on any attribute that exceeds the upper limit set by /SchemaPrep which I will detail later in this post.
Primary Issue and Symptoms:
As previously noted, the primary symptom at play was that an Exchange Administrator was experiencing intermittent failures when utilizing the Exchange Management Console (EMC) or Exchange Management Shell (EMS) to perform Mailbox Moves. When the move failed an error similar to what is documented below would occur:
Error: Custom Attribute2 is too long: maximum length is 1024 and the actual length is "1358"
Additionally when running Get-Mailbox against the impacted user mailbox the administrator would receive an error about the object being corrupt:
Warning: Object domain.com/Users/TestUser has been corrupted and it is in an inconsistent state.
The following validation errors have occurred:
Warning: CustomAttribute2 is too long: maximum length is 1024 and the actual length is 1358.
Troubleshooting:
The error being referenced would suggest that the mailbox is failing to move due to a large number of characters being present on the aforementioned attribute (msExchAttribute2). The most logical place to begin troubleshooting would be to first determine whether or not a large number of characters are in fact present on the user object in the Active Directory. A number of techniques can be used to determine this:
- LDP
- ADSI Edit
- Traditional Scripting
- Exchange Management Console:
- In the Console Tree of the Exchange Management Console select the Mailbox node under Recipient Configuration.
- Depending on how large your organization is you may want to increase the number of recipients to display in the Actions pane.
- Select View and then Add/Remove columns.
- Select CustomAttribute2 select Add, then move it into the Displayed Columns list (you may want to move it to the second column in the list under Display Name), then click OK.
- The Mailboxes Node will load albeit with warnings. If you open the Warnings dialog, a list of all users in this state will be presented:
- Windows PowerShell:
foreach ($mailbox in Get-Mailbox) { if ($mailbox.CustomAttribute2.Length -gt "1024") { Write-Host "Name: $($mailbox.Name)" Write-Host "Length: $($mailbox.CustomAttribute2.Length)" Write-Host "" } }

- Within LDP, copy the complete contents of the attribute to the clip-board.
- Open Notepad, disable word-wrap and add the Status Bar.
- Copy the complete value into Notepad.
- Calculate the total amount of characters.
- With Word-Wrap disabled a single line can only contain 1024 characters.
- With the Status-Bar enabled you can get an exact character count for the last line by simply placing the cursor at the end of the last character (will be displayed in the status window).
- To calculate, you simply multiple the number of complete lines by 1024 and add the value of characters from the last line.
Expanding base 'CN=ms-Exch-Extension-Attribute-2,CN=Schema,CN=Configuration,DC=<DOMAIN>,DC=com'... Result <0>: (null) Matched DNs: Getting 1 entries: >> Dn: CN=ms-Exch-Extension-Attribute-2,CN=Schema,CN=Configuration,DC=<DOMAIN<,DC=com 2> objectClass: top; attributeSchema; 1> cn: ms-Exch-Extension-Attribute-2; 1> distinguishedName: CN=ms-Exch-Extension-Attribute-2,CN=Schema,CN=Configuration,DC=<DOMAIN>,DC=com; 1> instanceType: 0x4 = ( IT_WRITE ); 1> whenCreated: 04/03/2002 15:15:43 Pacific Standard Time Pacific Daylight Time; 1> whenChanged: 04/12/2009 17:20:51 Pacific Standard Time Pacific Daylight Time; 1> uSNCreated: 6732; 1> attributeID: 1.2.840.113556.1.2.424; 1> attributeSyntax: 2.5.5.12; 1> isSingleValued: TRUE; 1> rangeLower: 1; 1> rangeUpper: 10240; 1> mAPIID: 32814; 1> uSNChanged: 46036019; 1> showInAdvancedViewOnly: TRUE; 1> adminDisplayName: ms-Exch-Extension-Attribute-2; 1> adminDescription: ms-Exch-Extension-Attribute-2; 1> oMSyntax: 64; 1> searchFlags: 17; 1> lDAPDisplayName: extensionAttribute2; 1> name: ms-Exch-Extension-Attribute-2; 1> objectGUID: bc303dd3-f496-4c60-a5fa-8647a42dd063; 1> schemaIDGUID: bf967969-0de6-11d0-a285-00aa003049e2; 1> attributeSecurityGUID: 1f298a89-de98-47b8-b5cd-572ad53d267e; 1> isMemberOfPartialAttributeSet: TRUE; 1> objectCategory: CN=Attribute-Schema,CN=Schema,CN=Configuration,DC=<DOMAIN>,DC=com; -----------So we can see here that the rangeLower value is set to 1 (which would be expected) and the rangeUpper value is set to 10240 (which would mean that the attribute itself can allow for 10240 individual characters). This large value explains why the failed object could have 1358 characters present on the AD object, but doesn't explain why the Mailbox Move operation would expect the value to be less than 1024. At first glance this looks like a really...really big bug. Why would we allow you to store 10240 characters on an attribute but fail a mailbox-move because we expect the value to be less than 1024 characters? But, under closer examination what struck me as curious was the relatively recent update to the object. In the LDP dump above you will notice that the whenChanged value for this object is: 04/12/2009 17:20:51 (early on in the call the customer had told me that they began deploying CAS servers in the environment nearly a year before hand). The whenChanged value in and of itself could be perfectly explainable (e.g. perhaps they decided to roll out SP1 which requires an upgrade of the Schema). On the other hand, perhaps a manual edit of the schema was performed to allow for this many characters. At this point, I wanted to continue troubleshooting by performing two valid action items:
- Compare the whenChanged value on another Exchange attribute (theoretically the whenChanged value "should be" nearly the same, as all Exchange objects should have been modified at roughly the same time (e.g. when /SchemaPrep was run)).
- Verify the default value for ms-Exch-Extension-Attribute-2 as defined in the LDF files for Exchange 2007 /SchemaPrep.
dn: CN=ms-Exch-Extension-Attribute-2,<SchemaContainerDN> changetype: add adminDescription: ms-Exch-Extension-Attribute-2 adminDisplayName: ms-Exch-Extension-Attribute-2 attributeID: 1.2.840.113556.1.2.424 attributeSyntax: 2.5.5.12 isMemberOfPartialAttributeSet: FALSE isSingleValued: TRUE lDAPDisplayName: extensionAttribute2 mapiId: 32814 name: ms-Exch-Extension-Attribute-2 oMSyntax: 64 objectCategory: CN=Attribute-Schema,<SchemaContainerDN> objectClass: attributeSchema rangeLower: 1 rangeUpper: 1024 schemaIdGuid:: aXmWv+YN0BGihQCqADBJ4g== searchFlags: 0Notice how rangeUpper = 1024. So at this point it is pretty safe to assume that a Schema Administrator (the only type of user who can make such a change) went in and manually modified the rangeUpper value on this object. In this case it looks like a "0" was simply appended to 1024. At this point, I was informed that there is a certain 3rd party tool out there that stores application specific user information on extensionAttribute2 and that the edit was necessary to allow the tool to work properly. Are Schema Edits Supported? Very simply, edits to the default Exchange schema have and never will be supported. The reason is that it is entirely possible that functionality could be added or removed that is dependent upon the values we expect to be present (as in this case). If you choose to go down this path your risks include but aren't necessarily limited to:
- Your Active Directory and Exchange implementation not working as expected.
- Being unsupported.
ms-Exch-Extension-Attribute-1 -- rangeUpper: 1024 ms-Exch-Extension-Attribute-2 -- rangeUpper: 1024 ms-Exch-Extension-Attribute-3 -- rangeUpper: 1024 ms-Exch-Extension-Attribute-4 -- rangeUpper: 1024 ms-Exch-Extension-Attribute-5 -- rangeUpper: 1024 ms-Exch-Extension-Attribute-6 -- rangeUpper: 1024 ms-Exch-Extension-Attribute-7 -- rangeUpper: 1024 ms-Exch-Extension-Attribute-8 -- rangeUpper: 1024 ms-Exch-Extension-Attribute-9 -- rangeUpper: 1024 ms-Exch-Extension-Attribute-10 -- rangeUpper: 1024 ms-Exch-Extension-Attribute-11 -- rangeUpper: 2048 ms-Exch-Extension-Attribute-12 -- rangeUpper: 2048 ms-Exch-Extension-Attribute-13 -- rangeUpper: 2048 ms-Exch-Extension-Attribute-14 -- rangeUpper: 2048 ms-Exch-Extension-Attribute-15 -- rangeUpper: 2048I hope you found this article interesting/useful. If you did, please leave some feedback. Happy Trails. - Eric Norberg
Updated Jul 01, 2019
Version 2.0The_Exchange_Team
Microsoft
Joined April 19, 2019
Exchange Team Blog
You Had Me at EHLO.