Page 1 of 1

DSQuery script

Posted: Wed Jul 09, 2008 5:48 am
by jwelch
I need to query AD and find all the active users in our company and find what groups they are in. How do I do this? Is this only a command line query or can I do this from "Active Directory Users and Computers"?

DSQuery script

Posted: Wed Jul 09, 2008 5:48 am
by jwelch
I need to query AD and find all the active users in our company and find what groups they are in. How do I do this? Is this only a command line query or can I do this from "Active Directory Users and Computers"?

DSQuery script

Posted: Thu Jul 10, 2008 4:20 am
by jhicks
Another approach if you have a text list of groups is this http://www.sapien.com/blog/2007/02/19/g ... uerydsget/

DSQuery script

Posted: Thu Jul 10, 2008 4:25 am
by joel.delatorre
Adfind can do this.adfind -b "dc=yourDomain,dc=com" -f "objectcategory=person" attr memberof, cn

DSQuery script

Posted: Thu Jul 10, 2008 4:30 am
by jhicks
Yep. I didn't even begin to mention all the other free tools that could get this done. Ultimately, jwelch, it depends on your comfort level and what you want to do with the information once you have it.

DSQuery script

Posted: Tue Jan 19, 2010 4:15 am
by cooldisks
Here is a script i wrote out to pull the information then i put it into notepad and use Find/Replace to strip out the undersiderable details. Hope it helps.

List users limit to max 2000 user and put out to a text file.
dsquery user -limit 2000 >listuser.txt

List users by Department to a text file:
dsquery user -limit 0 |dsget user -dept -dn >> userlistDept.txt

List Computers in network
dsquery computer -limit 2000 >CPUlist.txt

Hope you enjoy.

Alan Mitchell
cooldisks.com

DSQuery script

Posted: Tue Jan 19, 2010 5:01 am
by cooldisks
Figures lol its the way it goes i didnt even look at the date on it. I do have a useful tool here for others i created a XP version of DSquery scripting for my desktop by going into Windows 2003 and pulling out the following files, i placed them into a folder on my XP box and now i can query against any server without logging into it.

dsprop.dll, dsquery.dll, dsquery.exe, dsrestor.dll, dsrevt.dll, dsrm.exe, dssec.dat, dssec.dll, dssenh.dll, dssite.msc, dsuiext.dll, dsuiwiz.dll.

Since people are still finding their way here someone may use it. ;-)