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.

List OU Objects

 Keywords: List Enumerate Itemize OU Container Objects dsFindPath objectCategory organizationalunit

;***************************************************************************
;**
;**    List OU Objects
;**
;***************************************************************************
;Load Appropriate Extender
If WinMetrics(-2) == 3 Then AddExtender("WWADS64I.DLL") ; 64-bit
Else AddExtender("WWADS44I.DLL") ; 32-bit

; Construct the full domain ADSI path.
ServerDn = dsGetProperty("LDAP://rootDSE", "serverName")
ServerName = ItemExtract(1, ServerDn, ",")
ServerName = ItemExtract(2, ServerName, "=")
ServerDn = dsGetProperty("LDAP://rootDSE", "defaultNamingContext")
ServerPath = "LDAP://%ServerName%/%ServerDN%"

; Find the OU paths
OUPaths = dsFindPath(ServerPath, "(&(objectCategory=organizationalunit)(ou=*))")
myOUpath = AskItemlist('OU Objects', OUPaths, @TAB, @UNSORTED, @SINGLE )

Article ID:   W17533
Filename:   List OU Objects.txt
File Created: 2012:11:15:14:09:24
Last Updated: 2012:11:15:14:09:24