Excerpt from the getUsers Function
- Code:
var connection, command, recordSet, userList, distinguishedName,
pwdExpires, user;
// ------- BEGIN CALLOUT A -------
connection = new ActiveXObject("ADODB.Connection");
connection.Open("Provider=ADSDSOObject;");
command = new ActiveXObject("ADODB.Command");
command.ActiveConnection = connection;
command.Properties("Cache results") = false;
command.Properties("Timeout") = 60;
// ------- END CALLOUT A -------
// ------- BEGIN CALLOUT B -------
command.CommandText = "<LDAP://" + baseDN + ">;"
+ "(&(objectCategory=person)(objectClass=user)(mail=*)"
+ "(!(userAccountControl:1.2.840.113556.1.4.803:=2))"
+ "(!(userAccountControl:1.2.840.113556.1.4.803:=65536)))"
+ ";distinguishedName,sAMAccountName,givenName,sn,mail;"
+ (recurse ? "subtree" : "onelevel");
recordSet = command.Execute();
// ------- END CALLOUT B -------