KeithWilliams
Registered User.
- Local time
- Today, 20:09
- Joined
- Feb 9, 2004
- Messages
- 137
Hi,
I need a function to return all the groups that the current user belongs to, from Active Directory. I have spent about a day trawling through Google search results but found nothing that I can make work in VBA.
So far I have the following:
Set oConnection1 = CreateObject("ADODB.Connection")
Set oCommand1 = CreateObject("ADODB.Command")
oConnection1.Provider = "ADsDSOObject"
oConnection1.Open "Active Directory Provider"
Set oCommand1.ActiveConnection = oConnection1
oCommand1.CommandText = "select name from 'LDAP://HQ11' WHERE objectCategory='Group'"
Set rs = oCommand1.Execute
Do While Not rs.EOF
Debug.Print rs!name
rs.MoveNext
Loop
This lists all the Groups in Active directory. But I have no idea how to specify that I want only those groups that include the current user as a member.
Many thanks,
Keith.
I need a function to return all the groups that the current user belongs to, from Active Directory. I have spent about a day trawling through Google search results but found nothing that I can make work in VBA.
So far I have the following:
Set oConnection1 = CreateObject("ADODB.Connection")
Set oCommand1 = CreateObject("ADODB.Command")
oConnection1.Provider = "ADsDSOObject"
oConnection1.Open "Active Directory Provider"
Set oCommand1.ActiveConnection = oConnection1
oCommand1.CommandText = "select name from 'LDAP://HQ11' WHERE objectCategory='Group'"
Set rs = oCommand1.Execute
Do While Not rs.EOF
Debug.Print rs!name
rs.MoveNext
Loop
This lists all the Groups in Active directory. But I have no idea how to specify that I want only those groups that include the current user as a member.
Many thanks,
Keith.