WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

ADSI
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

AD OU Membership


Question:

Does anyone have a quick way that I can determine what OU or subOU a workstation object is a member of?

Answer:

AddExtender("wwads44i.dll")

; Computer name.
sComputer = "Columbia"

; Path to domain server. Could use domain dn
sPath = "LDAP://shamrock"

; Search filter to find computer "Columbia"
sFilter = StrCat("(&(objectCategory=Computer)(CN=", sComputer, "))")

; Do the search.
lResults = dsFindPath(SPath , sFilter)

; Should only be one path but to be safe...
sCompPath = ItemExtract(1, lResults, @TAB)

; Can either parse from sCompPath or
; use an extender function.
sOuPath = dsGetPrntPath(sCompPath)
Message("OU's full path", sOuPath)


Article ID:   W16790
File Created: 2007:07:03:14:26:16
Last Updated: 2007:07:03:14:26:16