I am using the net-ldap gem to search active directory.
I can search for users by using filter:
filter = Net::LDAP::Filter.eq("sAMAccountName", "neil*")
filter2 = ~Net::LDAP::Filter.eq("objectclass", "computer")
joined_filter = Net::LDAP::Filter.join(filter, filter2)
ldap.search(:base => treebase, :filter => joined_filter) do |entry|
puts entry.sAMAccountName
end
This gives me all the users whose sAMAccountName starts with neil and is not a computer account.
How do I add a filter that only searches enabled accounts?