itsraja
itsraja

Reputation: 1736

sAMAccountName and case-sensitivity

I'm able to fetch the user details for a particular ADS user through the following vbs code.

Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand = CreateObject("ADODB.Command")
Set objCommand.ActiveConnection = objConnection

objCommand.CommandText = _
    "<LDAP://"& objDomain.Get("distinguishedName") &">;" & _
    "(&(objectclass=user)(objectcategory=person)(sAMAccountName=" & strUserName & "));" & _
    "cn,displayName;subtree"
objCommand.Execute

Here could I want to apply LCase to sAMAccountName before comparing with strUserName. Is this possible?

Upvotes: 2

Views: 5926

Answers (1)

Ansgar Wiechers
Ansgar Wiechers

Reputation: 200483

sAMAccountName is case-insensitive, so it doesn't matter if the value of strUserName is in upper, lower, or mixed case.

Upvotes: 5

Related Questions