I have a python script to do things with non-disabled accounts (auto create zimbra accounts etc).
use 514 to do things with disabled accounts.
#userAccountControl 512 = normal , 514 = disabled account
Code:
#!/usr/bin/python
import ldap, string, os, time, sys
domain = "example.com"
l=ldap.initialize("ldap://server."+domain+":389") # pick an LDAP server
l.simple_bind_s("domain\\username","password")
scope = 'ou=domain,dc=com'
try:
res = l.search_s(scope,
ldap.SCOPE_SUBTREE, "(&(ObjectCategory=user) (userAccountControl=512)(employeeType=STUDENT))", ['sAMAccountName','givenName','sn'])
#userAccountControl 512 = normal , 514 = disabled account
for (dn, vals) in res:
do *whatever*
except ldap.LDAPError, error_message:
print error_message
l.unbind_s() oh, I think in future the boss is planning on adding user defined fields to SIMS (we have it in CMIS and apparently LA say its OK to migrate). We will have AD account name and disabled (yes/no) as user defined fields in SIMS.