"Thomas R Grassi Jr" <> wrote in message
news:%...
> How do you display all the OU's in AD on a Windows 2003 R2 Standard DC SP2
> Server?
>
> I thought I created one during the install of Sharepoint 3 but it seems to
> not be there.
>
> So what command or interface shows the OU defined?
>
> Any thioughts or ideas
>
> Thanks
>
> Tom
If your AD is complicated with many nested OU's, it might be easier to query
for all objects where (objectCategory=organizationalUnit). For example, a
VBScript program that uses ADO to query AD:
==========
Option Explicit
Dim adoCommand, adoConnection, strBase, strFilter, strAttributes
Dim objRootDSE, strDNSDomain, strQuery, adoRecordset, strName
' Setup ADO objects.
Set adoCommand = CreateObject("ADODB.Command")
Set adoConnection = CreateObject("ADODB.Connection")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
adoCommand.ActiveConnection = adoConnection
' Search entire Active Directory domain.
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
strBase = "<LDAP://" & strDNSDomain & ">"
' Filter on all OU objects.
strFilter = "(objectCategory=organizationalUnit)"
' Comma delimited list of attribute values to retrieve.
strAttributes = "distinguishedName"
' Construct the LDAP syntax query.
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
adoCommand.CommandText = strQuery
adoCommand.Properties("Page Size") = 100
adoCommand.Properties("Timeout") = 30
adoCommand.Properties("Cache Results") = False
' Run the query.
Set adoRecordset = adoCommand.Execute
' Enumerate the resulting recordset.
Do Until adoRecordset.EOF
' Retrieve values.
strName = adoRecordset.Fields("distinguishedName").Value
Wscript.Echo strName
adoRecordset.MoveNext
Loop
' Clean up.
adoRecordset.Close
adoConnection.Close
==========
You can also use the filter with Joe Richards' free adfind utility. See this
link:
http://www.joeware.net/freetools/tools/adfind/index.htm
--
Richard Mueller
MVP Directory Services
Hilltop Lab -
http://www.rlmueller.net
--