Simple script to pull group membership from AD

Associate
Joined
11 Sep 2009
Posts
2,368
Location
UK
Hi,
I am looking for a script that will pull the members of groups from AD.

There is plenty of examples out there on the web but they rely on you knowing where the group object lies in AD.

E.G.
Set objGroup = GetObject("LDAP://cn=remoteaccess,ou=Firewall Access,ou=groups,ou=MYDOMAIN Support,dc=Test,dc=internal,dc=com")

However, the domain layout is a complete mess, i could spend literally 15 minutes trying to find out where in the catalugue the object lies, to make matters worse, when i click object within users and computers it says Access denied, so no quick way to find the location! (Despite me being domain admin).

Any help appreciated as i appear to have inherited a mess :(

I would ideally like to give the script the group name and it would search all objects automatically without any more input.
 
Actually, a further update. I need to pull the group membership from hundreds of groups.....
This is gonna take a millenia :(

Any tools out there to help simplify this task, ideally a pop up box i can type the group into and it pushes the results to a text file.
 
You can wildcard search LDAP - don't need to fully qualify the path. Specify as much as you can to avoid killing the server :)

It's been years since I last did this so no examples sorry.
 
Back
Top Bottom