someone in the board give me some hints, however, I still not quite
understand, I need some script example, please. thanks
Wei
You will have to set up three separate searches with the three bases
you
have indicated. You can not exclude a certain branch from the search
when
searching at a higher level.
I.E.
You need one search with a search base at the ame ou
You need one search with a search base at the amd ou
You need one search with a search base at the bad ou
--
Joe Richards
www.joeware.net
---
Quote:> Hi,
> I am trying to OU from AD in vbscript, for example,
> ou=office,
> ou = ame
> ou = administrator
> ou = teacher
> ou = amd
> ou = bad
> my current script can show the all OUs, but what i want is only show
> OU=ame, ou=amd, ou=bad, I don't want those nest ou under ame, amd, and
> bad, does anyone have some idea to help me out?
> thanks in advance
> Wei
> below is my script
> Dim Result
> Dim Connection
> Dim rs
> Dim strSiteCN
> Set Connection = CreateObject("ADODB.Connection")
> Connection.Provider = "ADsDSOObject"
> Connection.Open "ADs Provider"
> strSQL = "SELECT distinguishedname FROM
> 'LDAP://ou=Offices,DC=child,DC=dev,DC=ORG' WHERE ObjectCategory =
> 'organizationalunit'"
> Set objRS = CreateObject("ADODB.Recordset")
> 'objRS.CursorLocation = adUseClient
> 'objRS.CursorLocation = 3 'adUserClint
> objRS.Open strSQL, Connection
> aIndex = 0
> Do While Not objRS.EOF
> ' Make sure the subnet is associated with a Site
> If Not IsNull(objRS.Fields("distinguishedname")) Then
> strSiteCN = objRS.Fields("distinguishedname")
> msgbox strSiteCN
> End If
> objRS.MoveNext
> Loop
> objRS.Close