September 2003
Intermediate to advanced
624 pages
15h 49m
English
You want to search against an attribute that contains a bit flag and you need to use a bitwise filter.
Follow the directions in Recipe 4.5 for searching for objects.
For the Filter, enter the bitwise expression, such as the following, which will find all universal groups:
(&(objectclass=group)(objectCategory=group)(groupType:1.2.840.113556.1.4.804:=8))
Click Run.
The following query finds universal groups using a bitwise OR filter:
> dsquery * cn=users,dc=rallencorp,dc=com -scope subtree -attr "name" -filter[RETURN]
"(&(objectclass=group)(objectCategory=group)(groupType:1.2.840.113556.1.4.804:=8) )"The following query finds disabled user accounts using a bitwise AND filter:
> dsquery * cn=users,dc=rallencorp,dc=com -attr name -scope subtree -filter[RETURN] "(&(objectclass=user)(objectcategory=person)(useraccountcontrol:1.2.840.113556.1.4.[RETURN] 803:=514))"
' The following query finds all disabled user accounts strBase = "<LDAP://cn=users,dc=rallencorp,dc=com>;" strFilter = "(&(objectclass=user)(objectcategory=person)" & _ "(useraccountcontrol:1.2.840.113556.1.4.803:=514));" strAttrs = "name;" strScope = "subtree" set objConn = CreateObject("ADODB.Connection") objConn.Provider = "ADsDSOObject" objConn.Open "Active Directory Provider" set objRS = objConn.Execute(strBase & strFilter & strAttrs & strScope) objRS.MoveFirst while Not objRS.EOF Wscript.Echo objRS.Fields(0).Value ...Read now
Unlock full access