Solved

List Users in an ADS Group

Posted on 2004-08-19
7
146 Views
Last Modified: 2010-04-13
Hi,

I am wanting to list all the users in an ADS group, but there are groups within this group, and possibly groups with in these child groups.  (I didn't set this up!!)

I would like the output to show all the users in the parent group, all child groups with all their members and any groups there, and so on.  I need this to get a list of all users which have permissions on a set of resources.  I realise I can do this manually, but it's a total mess and will take ages, so an automated way would be very useful.

If this question doesn't make sense, please let me know and I'll do my best to clarify!

Thanks for your help!
0
Comment
Question by:Dak
  • 2
  • 2
7 Comments
 
LVL 17

Expert Comment

by:Eagle6990
ID: 11842558
I don't know for sure if this will just list another group or actually break out everyone but try this command just for fun.

net group "Groupname" /domain

It should list all of the members of the group, but I don't know what a nested group will do.
0
 

Author Comment

by:Dak
ID: 11842906
Hi there!

Thanks for the suggestion, but this only displays the users in the group and not any groups in there, or any sub groups.

Any other thoughts?

Cheers.
0
 

Author Comment

by:Dak
ID: 12339110
Hi there,

I am very interested in finding a resolution to this question, but there does not seem to be any forthcoming answers.  I have responded to all comments added to the thread, and have in no way abondoned it.

If you feel the need to close the call, then do so but I would prefer an answer to the query before you do so.

Thanks.
0
 
LVL 17

Expert Comment

by:Jared Luker
ID: 12956255
This worked out pretty good for me... you'll have to change the strGroupDN to match your domain, but it seems to work pretty well.

'Listing 1: Enum_groups.vbs

option explicit

Dim objArgs, strGroupDN
set objArgs = WScript.Arguments
if objArgs.Count <> 1 then
   Dim objRootDSE
   set objRootDSE = GetObject("LDAP://RootDSE")
   strGroupDN = "cn=Domain Admins,cn=users," & objRootDSE.Get("defaultNamingContext")
else
   strGroupDN = objArgs.Item(0)
end if

Dim dicSeenGroupMember
set dicSeenGroupMember = CreateObject("Scripting.Dictionary")
Wscript.Echo "Members of " & strGroupDN & ":"
DisplayMembers "LDAP://" & strGroupDN, " ", dicSeenGroupMember

Function DisplayMembers (strGroupADsPath, strSpaces, dicSeenGroupMember)

   Dim objGroup, objMember
   set objGroup = GetObject(strGroupADsPath)
   for each objMember In objGroup.Members

      Wscript.Echo strSpaces & objMember.Get("distinguishedname")
      if objMember.Class = "group" then

         if dicSeenGroupMember.Exists(objMember.ADsPath) then
            Wscript.Echo strSpaces & "   ^ already seen group member " & _
                                     "(stopping to avoid loop)"
         else
            dicSeenGroupMember.Add objMember.ADsPath, 1
            DisplayMembers objMember.ADsPath, strSpaces & "  ", _
                           dicSeenGroupMember
         end if

      end if

   next
End Function

0
 
LVL 17

Accepted Solution

by:
Jared Luker earned 250 total points
ID: 14135047
I think that I should get the points.  I provided a script that I think does what the author was looking for
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
A safe way to clean winsxs folder from your windows server 2008 R2 editions
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now