Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
AddExtender("WWADS34I.DLL") Output=FileOpen(Strcat(Environment("Temp"),"\DisabledUsers.txt"),"WRITE") BoxOpen("Processing","Processing, Please Wait") search=DsFindPath("LDAP://DOMAIN", "(ObjectClass=User)") Count=ItemCount(search,@TAB) For x = 1 to Count Item=ItemExtract(x,search,@TAB) BoxText(Item) a=dsGetProperty(Item, "userAccountControl") If a & 2 FileWrite(Output,Item) EndIf Next FileClose(Output) Run("Notepad.txt",Output)The question, how / if I can make DsFindPath do something like the following so I don't have to go through every object:
search=DsFindPath("LDAP://DOMAIN", "(&(ObjectClass=User)(userAccountControl = & 2))")
Example:
search=DsFindPath("LDAP://DOMAIN", "(&(&(ObjectClass=User)(userAccountControl:1.2.840.113556.1.4.803:=2))(!(ObjectClass=Computer)))")Note: You can speed up your search by using the "objectCategory" property. For example, (&(objectCategory=person)(userAccountControl:1.2.840.113556.1.4.803:=2))....*
ObjectCategory contains the predominate class of an object and is indexed by AD, so it is faster than using ObjectClass. You will even get a performance boost by using both ObjectCategory and ObjectClass in a search specification.
*Note: the above example search filter has not been tested.
or
http://msdn.microsoft.com/library/shared/deeptree/asp/rightframe.asp?dtcfg=/library/deeptreeconfig.xml&url=/library/en-us/ad/ad/finding_objects_by_class.asp?frame=true&hidetoc=false I suspect you have a problem in the logic of your search filter or someone has been mucking about with your directory schema without knowing exactly what they were doing.
Article ID: W16317
File Created: 2005:02:18:12:19:46
Last Updated: 2005:02:18:12:19:46