Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

I need Active Directory Group Member Report

Posted on 2007-07-23
4
Medium Priority
?
3,913 Views
Last Modified: 2009-07-29
I need a free utility or dos based script that will report all of my active directory groups in the entire domain including their members.

I have found some things online, but where I am running into trouble is with nested groups.  I need it to handle nested groups.
0
Comment
Question by:lpenrod
  • 2
4 Comments
 
LVL 51

Expert Comment

by:Netman66
ID: 19548002
The Support Tools should do the job.

dsquery group | dsget group -members  >> c:\groupmembership.txt

0
 
LVL 86

Accepted Solution

by:
oBdA earned 2000 total points
ID: 19560310
Not quite, sorry.
This will only list the first 100 groups if there are more than a hundred, and it will create a list with multiple entries of user names without any association to the groups they're in.
This should do the trick (can't test it at the moment, though). It currently logs into one large file, separating the groups with 10 dashes, followed by the group DN.
If you'd like it better, this can be changed to create one file named like the group for each group, instead of the large single file.

@echo off
setlocal
:: *** Path and name to the file with the group membership:
set LogFile=GroupMembership.txt
for /f "delims=" %%a in ('dsquery group -limit 0') do call :process %%a
goto :eof
:process
set GroupDN=%~1
echo ---------- %GroupDN% Begin ----------
dsget group "%GroupDN%" -members -expand
echo ---------- %GroupDN% End ----------
goto :eof
0
 

Expert Comment

by:carolinatechsolutions
ID: 22325786
I cannot get the "GroupMembership.txt" file to appear.  (yes, I know it's a year old!)

I have attempted to include a full path and searched (it should be in the working directory) and it is not created.
0
 
LVL 86

Expert Comment

by:oBdA
ID: 22327004
Currently, it's only generating output to the console; you can redirect the output to a text file by adding
>SomeReport.txt
after the command:
ListGroupMembership.cmd >SomeReport.txt
Or use the one below:
@echo off
setlocal
:: *** Path and name to the file with the group membership:
set LogFile=GroupMembership.txt
if exist "%LogFile%" del "%LogFile%"
for /f "delims=" %%a in ('dsquery group -limit 0') do call :process %%a
goto :eof
:process
set GroupDN=%~1
echo Processing %GroupDN%
>>"%LogFile%" echo ---------- %GroupDN% Begin ----------
>>"%LogFile%" dsget group "%GroupDN%" -members -expand
>>"%LogFile%" echo ---------- %GroupDN% End ----------
goto :eof

Open in new window

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us need to configure DHCP server(s) in their environment. We can do that simply via DHCP console on server or using MMC snap-in on each computer with Administrative Tools installed in a network. But what if we have to configure many DHCP ser…
Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…

564 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