Solved

Query AD

Posted on 2009-05-13
2
279 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 57

Accepted Solution

by:
Mike Kline earned 250 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

Suggested Solutions

This article shows the method of using the Resultant Set of Policy Tool to locate Group Policy that applies a particular setting.
A hard and fast method for reducing Active Directory Administrators members.
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 …
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

739 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