We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

active directory query

steveLaMi
steveLaMi asked
on
Medium Priority
249 Views
Last Modified: 2010-04-18
I am trying to create a query in active directory that will show me the members of a certain group.  Anyone know how to do this?
Comment
Watch Question

Commented:
Hi,

Try this vbscript just save as a vbscript and edit the group name, OU and domain info.

On Error Resume Next
 
Set objGroup = GetObject _
  ("LDAP://cn=GroupName,ou=Sales,dc=mydomain,dc=com")
objGroup.GetInfo
 
arrMemberOf = objGroup.GetEx("member")
 
WScript.Echo "Members:"
For Each strMember in arrMemberOf
    WScript.echo strMember
Next

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
CERTIFIED EXPERT
Top Expert 2006

Commented:
dsget group "cn=Groupname,ou=OUname,DC=Domain,DC=Local" -members
net group "groupname" will also show you the members of a group and this should be run on a DC

Hope this simple command helps you
Lots of great answers. As a 0 point refinement to Jays submission.

dsquery group -name "groupname" | dsget group -members

CERTIFIED EXPERT
Top Expert 2006

Commented:
Show off!! **Grin** :-)
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.