WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

ADSI
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

dsFindPath Limitation

 Keywords: dsFindPath Limitation 20 Characters SAMAccountName

Question:

If the SAMAccountName exceeds 20 bytes, dsfindpath is unable to locate the object.Is there some sort of pre-Windows 2000 limitation in the call?I'm on WB 2006, so maybe it's been fixed already?
adsiPath= dsfindpath ("LDAP://DC=mydomain,DC=net", "(& (objectClass=User) (SAMAccountName=CharlieBrown))")

Answer:

This is not a bug in the ADSI extender. ADSI simple does not allow for samAccountNames greater than 20 characters. If you use the 'Active Directory Users and Computers' applet to add a user to AD, you will notice that it automatically truncates the name to 20 characters (at least on Win2k3). This is not controlled by the AD schema so you can't make a schema change to modify this length limit.

You might want to consider performing a multi-property search as a way to have more confidence in your results. A link to the 'sAMAcountName' property syntax http://msdn.microsoft.com/en-us/library/ms679635(VS.85).aspx More: The presentation of Active Directory attributes by GUI interfaces and even some command line software can be confusing because the presentation doesn't necessarily correlate with how the attributes are actually stored in Active Directory.

I believe you are looking for the 'userPrincipalName' or UPN which is used to log on to a domain. The UPN is the logon name and the UPN suffix that must be appended to the name. The UPN suffix is usually an at sign(@) followed by the domain name, i.e. joeuser@mydomain.com.

MSFT considers the 'sAMAccountName' property a down level name maintained for backward compatibility with pre-W2k systems. That is why it has a 20 character limit for user objects.


Article ID:   W17525
Filename:   dsFindPath Limitation.txt
File Created: 2012:11:26:09:50:34
Last Updated: 2012:11:26:09:50:34