Table of Contents

Microsoft - Active Directory - LDAP - Queries

Microsoft TechNet - LDAP Query Basics
Microsoft Support - XADM: Browsing and Querying Using the LDP Utility (KB255602)
Microsoft Support - How to use the UserAccountControl flags to manipulate user account properties
NetVision - Active Directory UserAccountControl values Quick Reference

Examples

All active users with mailbox

(&(objectCategory=user)(homeMDB=*)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))

All disabled users with mailbox

(&(objectCategory=user)(homeMDB=*)(userAccountControl:1.2.840.113556.1.4.803:=2))

All users with Password never expires ON

(&(objectCategory=user)(userAccountControl:1.2.840.113556.1.4.803:=65536))

All users with Password never expires OFF

(&(objectCategory=user)(!(userAccountControl:1.2.840.113556.1.4.803:=65536)))

All Domain Controllers

(&(objectCategory=computer)(userAccountControl:1.2.840.113556.1.4.803:=8192))

Source:SelfADSI - How to search and find Active Directory domain controllers