Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Query AD

Posted on 2009-05-13
2
Medium Priority
?
300 Views
Last Modified: 2012-05-06
Can someone help me out. I need to run a query against AD. I need to see all users in an OU and need to get back full name, email address, enabled/disabled and exchange store information.
0
Comment
Question by:Y2KBDS
2 Comments
 
LVL 57

Accepted Solution

by:
Mike Kline earned 1000 total points
ID: 24377657
I like adfind for this
http://www.joeware.net/freetools/tools/adfind/index.htm
enabled and disabled is part of the userAccountControl attribute. This happens to be an example of a bitmask attribute: a single attribute that actually houses numerous property values so there is no Yes/No column to show that.
What I do is run two queries - one for  enabled and one for disabled
DISABLED
adfind -b "DN of your OU" -bit -f "&(objectcategory=person)(objectclass=user)(useraccountcontrol:AND:2)" samaccountname givenname sn mail -csv > c:\disabledusers.csv
ENABLED -- just add the ! (not) to useraccountcontrol
adfind -b "DN of your OU" -bit -f "&(objectcategory=person)(objectclass=user)(!useraccountcontrol:AND:2)" samaccountname givenname sn mail -csv > c:\enabledusers.csv
Thanks
Mike
0
 
LVL 18

Expert Comment

by:Americom
ID: 24378208
You should be able to get all those info by simply running the "Saved Queries" from Active Directory Users and Computers console. You can save the queries or export them as well.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
Let's recap what we learned from yesterday's Skyport Systems webinar.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
Suggested Courses

916 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