OCS Gathering of the Report Pack for OCS in Messagestats fails with the following error in the MessageStats Application Log:
Database error = Application uses a value of the wrong type for the current operation
This is due to the Distinguished Name being too long
STATUS
Waiting fix in future release of MessageStats. Defect TF00143374 has been raised for this issue
WORKAROUND
Shorten the Distinguished Names in AD by editing them with ADSIEdit
MessageStats polls AD through WMI. MessageStats reads user's distinguished name and passes the resulting DN a new request AD as a parameter. If DN is not very long, then the query returns the user attributes that are stored in the database. Otherwise (if DN is too long) query returns an error and MessageStats tries to write the text of the error in the field which should store these attributes. MessageStats knows how to handle SQL errors but cannot handle WMI errors. Cutting the names of OU in AD works around the issue