LDAP filter for disabled computers
Using LDAP filters to filter out disabled computer accounts in Active Directory
I Needed to get a comprehensive list of computers on our domain but wanted to exclude the disabled objects. I thought it was going to be a pain, but LDAP filters saved the day.
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)))