dsquery, get list of user firstname+lastname,email address, groups belonged to > into a csv file

hi there,

should be an easy 2000 points for someone:

what command or set of commands can i run on my exchange server to export a CSV file which includes one line per user, in something at least close to this format:
firstname lastname, email address, groups belonged to

LVL 24
B HAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

Mike KlineCommented:
Does it have to be dsquery/dsget

I really like adfind (or quest cmdlets/powershell)

for adfind


adfind -default  -f "&(objectcategory=person)(objectclass=user)" givenname sn mail memberof -csv -nodn > c:\users.csv

As you can see I only outputted certain fields but you can add or remove as you want.  Good page that shows what all the attributes are behind the GUI




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
B HAuthor Commented:
no it doesn't have to be dsquery, i didnt realize adfind existed - whatever is easier,  someone asked for this list and the quicker i can get it off my plate the better :)

i'll go try adfind right now
B HAuthor Commented:
that worked great, thanks!
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
Active Directory

From novice to tech pro — start learning today.