Re: Query users from specific groups

Tech-Archive recommends: Speed Up your PC by fixing your registry



Mihai Serban wrote:

I want to extract from Active Directory all users who are membes of
specific groups, starting with "ras". Can help me to resolv that problem?

Thanks

Hi,

You can use ADO in a script. Info on ADO linked here:

http://www.rlmueller.net/ADOSearchTips.htm

In you case (based on the first example in the above link), use:

strFilter = "(&(objectCategory=group)(sAMAccountName=ras*))"
strAttributes = "sAMAccountName,member"

This will return one row for each group whose NetBIOS name starts with
"ras". It will return the NetBIOS name of the group and the member
multi-valued attribute. For each group (row in the recordset) you will have
to enumerate the member collection. There is an example in the link to
enumerate the memberOf attribute, which is similar to the member attribute.
The same method can be used.

You also might be able to use ADFind for this, Joe Richard's utility.

--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net


.



Relevant Pages

  • Re: New Scripter - Listing members of Groups in AD
    ... The Script am using is: ... You need to bind to the member object to retrieve ... Dim objGroup, objMember ... you can enumerate all the groups in the OU. ...
    (microsoft.public.windows.server.scripting)
  • Re: Script for Accessing NT Global Groups.
    ... I am not very familar with VB script. ... enumerate the domain groups the user is a member of. ... For Each objGroup In objUser.Groups ... If you mean to enumerate only Global groups, ...
    (microsoft.public.scripting.vbscript)
  • Re: Need Help. Beginner in Scripting
    ... I found this sample code in Script Repository but I would have to enter ... If all of your OU's are in the same hierarchy of AD, you can modify the base ... Another approach would be to modify the snippet you posted to enumerate ... The "member" attribute is a multivalued collection of member Distinguished ...
    (microsoft.public.windows.server.scripting)
  • Re: active directory question
    ... Thank you for the time you took to review this script. ... Later you seem to use ADO to find the trustee. ... The only attribute you need retrieve is "member". ...
    (microsoft.public.scripting.vbscript)
  • Re: Script to populate Distribution list
    ... that list several diffrent zip codes for the same location is there a way to ... > ' Check if user already a member of the group. ... This would slow the script ... > methods require the AdsPath of the user. ...
    (microsoft.public.scripting.vbscript)