I am using the following query to pull the groups that a username belongs to:
Set Conn = CreateObject("ADODB.Connection")
Set Comm = CreateObject("ADODB.Command")
Conn.Provider = "ADsDSOObject"
Conn.Open "Active Directory Provider"
Set Comm.ActiveConnection = Conn
Comm.Properties("Searchscope") = 2
FQDN = "DC=" & Replace(FQDN, ".", ",DC=")
Base = "<LDAP://" & Server & "/" & FQDN & ">"
Fltr = "(&(objectClass=*)" & "(sAMAccountName=" & Username & "))"
Attr = "SAMAccountName, memberof"
Scope = "subtree"
Comm.CommandText = Base & ";" & Fltr & ";" & Attr '& ";" & Scope
Set Response = Comm.Execute
This works except that it's not returning all the groups that a user belongs to. I have a user, call him "Kyle", that belongs to "Domain Users" and another group called "RDOC Group" but only the second group is being returned in my query.
I feel like this is a simple thing but changing the scope doesn't seem to be the answer, nor does modifying the filter (at least that I've tried).
Any ideas?