Hi to all you guys, this is my first thread, well this is my question: Im using an LDAP SQL statement to retireve a user OU, but I want to look the OUs for all users beginning with a letter Example: A%

This is the code I use:

Set rs = CreateObject("adodb.recordset")
Connstring = "Provider=ADsDSOObject"

strSQL = "SELECT distinguishedName FROM 'LDAP://ou=es,dc=prg-dc,dc=dhl,dc=com' WHERE sAMAccountName = 'jdoe'"
rs.Open strSQL, Connstring
    Do Until rs.EOF
WScript.Echo rs("distinguishedName")

strUserDN = LCase(fullpath)
Set objUser = GetObject ("LDAP://" & strUserDN)
Thanks a lot...

Last edited by shabbir; 6Aug2007 at 19:48.. Reason: Code block - http://www.go4expert.com/forums/misc.php?do=bbcode#code