![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
this vba wil get me a list of contacts, and changing the object class to 'user' will give a list of users from AD is there a way to get a list of users in a security group ? distribution group ? * * Dim objConnection As New ADODB.Connection * * Dim rs As ADODB.Recordset * * Dim objCommand As New ADODB.Command * * objConnection.Provider = "adsdsoobject" * * objConnection.Open "Active Directory Provider" * * Set objCommand.ActiveConnection = objConnection * * objCommand.Properties("Page Size") = 1000 * * objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE * * objCommand.Properties("Sort On") = "Name" * * objCommand.CommandText = "SELECT *" & _ * * * * * * * * * * * * * * *" *FROM 'LDAP://OU=foo,DC=bar,DC=com'" & _ * * * * * * * * * * * * * * *" WHERE objectCategory ='person'" & _ * * * * * * * * * * * * * * *" * AND objectClass = 'contact'" * * Set rs = objCommand.Execute * * While (Not (rs.EOF)) * * * * Debug.Print rs!ADSPATH * * * * rs.MoveNext * * Wend |
#3
| |||
| |||
|
|
On Jan 17, 3:34*pm, Roger <lesperan... (AT) natpro (DOT) com> wrote: this vba wil get me a list of contacts, and changing the object class to 'user' will give a list of users from AD is there a way to get a list of users in a security group ? distribution group ? * * Dim objConnection As New ADODB.Connection * * Dim rs As ADODB.Recordset * * Dim objCommand As New ADODB.Command * * objConnection.Provider = "adsdsoobject" * * objConnection.Open "Active Directory Provider" * * Set objCommand.ActiveConnection = objConnection * * objCommand.Properties("Page Size") = 1000 * * objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE * * objCommand.Properties("Sort On") = "Name" * * objCommand.CommandText = "SELECT *" & _ * * * * * * * * * * * * * * *" *FROM 'LDAP://OU=foo,DC=bar,DC=com'" & _ * * * * * * * * * * * * * * *" WHERE objectCategory ='person'" & _ * * * * * * * * * * * * * * *" * AND objectClass = 'contact'" * * Set rs = objCommand.Execute * * While (Not (rs.EOF)) * * * * Debug.Print rs!ADSPATH * * * * rs.MoveNext * * Wend use this command text will enumerate the groups * * objCommand.CommandText = "SELECT *" & _ * * * * * * * * * * * * * * *" *FROM 'LDAP://OU=foo,DC=bar,DC=com'" & _ * * * * * * * * * * * * * * *" WHERE objectCategory ='group'" & _ * * * * * * * * * * * * * * *" * AND objectClass = '*'" but I'm still looking to enumerate the users in a specific group- Hide quoted text - - Show quoted text - |
![]() |
| Thread Tools | |
| Display Modes | |
| |