04 July, 2017

Active Directory Users and Computers filter for disabled computer accounts

Use the following LDAP filter shows all the disabled computers in a particular OU:

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

To filter out disabled computers, showing only active objects use this:

(&(objectCategory=Computer)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))