how do I list Distribution Group (List) and their members inside of an OU using AD or exchange 2010
        Posted  
        
            by 
                wraak
            
        on Server Fault
        
        See other posts from Server Fault
        
            or by wraak
        
        
        
        Published on 2012-11-20T18:48:38Z
        Indexed on 
            2012/11/23
            11:02 UTC
        
        
        Read the original article
        Hit count: 225
        
our entire domain has thousands of distribution groups, while i can use the script referenced here: How to get a list of all Distribution Lists and their Members in Exchange 2007? to pull all distribution groups and their members, it would be too hard to filter through all results.
I particularilly need to pull either a. (preferred) all groups (both distribution and security) and their members inside of an OU (this particular OU contains over 100 hundred groups) or b. all groups and members matching a name starting with exampl*
dsquery | dsget looks like could almost serve that purpose however when i did:
dsquery group "OU=my-department,DC=blah,DC=blahblah,DC=com" -name * | dsget group -members (-expand) >> c:\my-department.txt
it displays only the members without showing which group they belong to. The output I need should have: group name, members and potentially expanded sub-groups.
i am still researching on how to get this done, seems like i can somehow make the above referenced script to search only inside of an OU, but i am not very familiar with powershell.
any help would be appreciated, thank you.
© Server Fault or respective owner