troubleshooting Question

searching through AD regardless the case of the username letters

Avatar of nayel
nayelFlag for United Arab Emirates asked on
DatabasesWindows Server 2003
6 Comments1 Solution448 ViewsLast Modified:
friends,
i have syncing script to sync account information between our BANNER (oracle) system and AD accounts, i'm reading from the BANNER and search for same ID in AD usernames to get the AD user object and update the information here is the searching lines:

==========================================
Set ADConnection = CreateObject("ADODB.Connection")
Set ADCommand = CreateObject("ADODB.Command")
ADConnection.Provider= "ADsDSOObject"
ADConnection.Open "Active Directory Provider"
Set ADCommand.ActiveConnection = ADConnection
ADCommand.CommandText= "SELECT mobile,telephonenumber,title,employeeid,company,department,departmentnumber,mail,userPrincipalName,Name,givenname,sn,initials,ADsPath,displayName,userCategory ,distinguishedName,sAMAccountName FROM 'LDAP://DC=aa,DC=uaeu,DC=ac,DC=ae' WHERE objectCategory='User' AND sAMAccountName='" & LDAP_Username & "'"
ADCommand.Properties("Page Size")       = 1000
ADCommand.Properties("Searchscope") = 2
Set ADRecordSet = ADCommand.Execute
=================================================

now in line:
--------------------------------
ADCommand.CommandText= "SELECT mobile,telephonenumber,title,employeeid,company,department,departmentnumber,mail,userPrincipalName,Name,givenname,sn,initials,ADsPath,displayName,userCategory ,distinguishedName,sAMAccountName FROM 'LDAP://DC=aa,DC=uaeu,DC=ac,DC=ae' WHERE objectCategory='User' AND sAMAccountName='" & LDAP_Username & "'"
-----------------------------------------------------

we have some sAMAccountName has a capital letters, i already converting the varaible LDAP_Username  to lower case before running the statement, but how can i converting the sAMAccountName to lower case ?? i used the LOWER() function but it not working with AD Provider !!!


     
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros