• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 306
  • Last Modified:

Query AD

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
Y2KBDS
Asked:
Y2KBDS
1 Solution
 
Mike KlineCommented:
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
 
AmericomCommented:
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now