Hi, I meant to get to this one earlier, but here's a HTA that will build and list the OU structure from your LDAP server in a list box....
Regards,
Rob.
<head>
<title>List OU Strucutre</title>
<HTA:APPLICATION
APPLICATIONNAME="List OU Structure"
SCROLL="no"
SINGLEINSTANCE="yes"
WINDOWSTATE="maximize"
>
<script language='vbs'>
<!--
' ******************************************************************************
Option Explicit
Sub Window_OnLoad
Dim strBaseConnString
Dim objOULevel
Dim intLevel
Dim objRootDSE
Set objRootDSE = GetObject("LDAP://RootDSE")
strBaseConnString = objRootDSE.Get("defaultNamingContext")
Set objOULevel = GetObject("LDAP://" & strBaseConnString)
RecurseOUs objOULevel, 0, strBaseConnString
End Sub
Sub RecurseOUs(objOU, intLevel, strBaseConn)
Dim objOUObject, strConnString, objActiveOption
For Each objOUObject In objOU
If UCase(Left(objOUObject.Name, 3)) = "OU=" Then
strConnString = objOUObject.DistinguishedName
Set objActiveOption = Document.CreateElement("OPTION")
If intLevel = 0 Then
objActiveOption.Text = Replace(objOUObject.Name, "OU=", "")
Else
objActiveOption.Text = String(intLevel * 4, " ") & "-> " & Replace(objOUObject.Name, "OU=", "")
End If
objActiveOption.Value = strConnString
lstSiteFilter.Add objActiveOption
RecurseOUs GetObject("LDAP://" & strConnString), intLevel + 1, strBaseConn
End If
Next
End Sub
Sub Show_Selection
spanSiteFilter.InnerHTML = lstSiteFilter.Value
End Sub
-->
</script>
</head>
<body>
<br><br><br>
<table width='80%' height='40%' align='center' border='0'>
<tr height='10%'>
<td colspan=2>
<font face='Arial' size='4'>Site Selected:</font>
<font face='Arial' size='3'>   <span id = 'spanSiteFilter'></span></font>
</td>
</tr>
<tr height='20%'>
<td>
<font face='Arial' size='4'>Site Filter:  </font>
<select size='1' name='lstSiteFilter' onChange='vbs:Show_Selection'>
</select>
</td>
</tr>
</table>
</body>
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78:





by: SagiEDocPosted on 2008-06-09 at 05:52:57ID: 21742755
dsquery ou run in a command window will list all OU's. You could run dsquery ou >c:\list.csv whiuch will write the result to a text file, which you could then read and use to populate a list.