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*
Daro's answer about using !(userAccountControl:1.2.840.113556.1.4.803:=2) is completely correct, but I could not make it work with ruby net/ldap using the Net::LDAP::Filter.join method.
I did however manage to implement it with Net::LDAP::Filter.construct, eg
filter = Net::LDAP::Filter.construct("(&(objectClass=User)(memberOf=CN=mygroup,OU=Groups,DC=myplace)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))")