AD User (memberof) reports


Long story short I need a solution to be able to query specified users within an Active Directory environment (2003) and have it return the specific groups that user is in.

I would prefer having it exported to an xls or pdf, but anything would work at this point.

For example...

Username  -  Date



I've messed a bit with powerhsell, dsquery,etc and haven't found a clean way to do this. I've also tried the tool ADInfo (Free) to no success.

Thank you

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

With DSQuery you can do something like this:

Users.txt has list of users and in the same folder as the batch file.

for  /F %%U in (Users.txt) do (
 Echo %%U  >> Memberof.txt
 dsquery user -samID %%U | dsget user -memberOf >> Memberof.txt

Open in new window

jkosseAuthor Commented:
How do I format the Users.txt. When I do this I get a memberof.txt with just a First name.
Thomas Zucker-ScharffSolution GuideCommented:
The LUSER app does just about everything - have you tried it?
Learn Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

jkosseAuthor Commented:
I just downloaded it, and Trendmicro is blocking it as a remotead ap virus.
Users.txt file should contain usernames (samid). Just one name in each line.
Thomas Zucker-ScharffSolution GuideCommented:
It is not a virus, you can upload it to virustotal if you would like to check it.  I've used it for some time with no problems.  I think it is probably because of the remote way it can query AD that you are getting that result.

Use these free tools, awesome tool to query.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jkosseAuthor Commented:
The ADShowUserGroup program worked as I needed it.

Thank you
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
IT Administration

From novice to tech pro — start learning today.