Re: NEWBIE: Pulling basic AD data
From: KWilliams (anonymous_at_discussions.microsoft.com)
Date: 09/01/04
- Next message: JacksonS: "Active Directory Week of Webcasts"
- Previous message: Laura E. Hunter \(MVP\): "Re: sub domain"
- In reply to: Matjaz Ladava [MVP]: "Re: NEWBIE: Pulling basic AD data"
- Next in thread: KWilliams: "Re: NEWBIE: Pulling basic AD data"
- Reply: KWilliams: "Re: NEWBIE: Pulling basic AD data"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 1 Sep 2004 07:56:48 -0700
Hi Matjaz,
After doing some testing, I realized the same thing. I
then found a solution that uses LDAP from an ASP 3.0
book, and it appears to work partially. But when it gets
to Line , it stalls. If I remove the repeat, it runs fine
but doesn't pull up any records. I've also tried limiting
the Record count to under 10, but it still locks up. I've
included the code below. If you see anything that I'm
obviously doing incorrectly, it would be greatly
appreciated to hear your advice. Thanks Matjaz.
KWilliams
LDAP CODE:
<%@ LANGUAGE="VBSCRIPT" %>
<html>
<head>
<title>ADSI Search Page</title>
</head>
<body>
<h1>ADSI Search Page</h1>
This page uses ADSI to search a directory
<p><strong>Search Request:</strong><br>
<%
On Error Resume Next
Dim strSearchBase
strSearchBase = "LDAP://dc=SERVER,dc=NAME"
Dim strFilter
strFilter = "(objectCategory=USERNAME)"
Dim strAttribs
strAttribs = "sAMAccountName,ADsPath"
Dim strScope
strScope = "subtree"
Response.Write "Search Base: " & strSearchBase & "<br>"
Response.Write "Filter: " & strFilter & "<br>"
Response.Write "Properties Requested: " & strAttribs
& "<br>"
Response.Write "Scope: " & strScope & "<br>"
Dim strCommandText '<<--Line 27
'strCommandText = "<" & strSearchBase & ">;name;" &
strScope
strCommandText = "<" & strSearchBase & ">;name" _
& strFilter & ";" & strAttribs & ";" & strScope
Response.Write "<strong>Command Text: </strong><br>"
Response.Write Server.HTMLEncode(strCommandText) & "<p>"
Dim objConnection
Set objConnection = Server.CreateObject
("ADODB.Connection")
Dim objCommand
Set objCommand = Server.CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = strCommandText
Dim objRecordset
Set objRecordset = objCommand.Execute(strCommandText)
Response.Write "<table border=4><tr>"
If (Not objRecordset.EOF) Then
For Each objField in objRecordset.Fields
Response.Write "<td>"
Response.Write objField.Name
Response.Write "</td>"
Next
End If
Response.Write "</tr>"
'While Not objRecordset.EOF AND Count <= 10
Response.Write "<tr>"
For Each oField in objRecordset.Fields
Response.Write "<td>"
Response.Write objField.Value
Response.Write "</td>"
Next
Response.Write "</tr>"
' objRecordset.MoveNext
'Wend
Response.Write "</tr></table>"
%>
</body>
</html>
>-----Original Message-----
>>From the code I can see, that you are using WinNT
provider. I would suguest
>you to use LDAP provider as it is more powerfull. WinNT
provider is for
>backward compatibility with NT systems and does not
exposes all user
>attributes.
>To get LDAP distinguished name from username use
NameTranslate object
>(http://www.rlmueller.net/NameTranslateFAQ.htm#What%20is%
20NameTranslate)
>
>--
>lp
>
>Matjaz
>http://www.slowug.org
- Next message: JacksonS: "Active Directory Week of Webcasts"
- Previous message: Laura E. Hunter \(MVP\): "Re: sub domain"
- In reply to: Matjaz Ladava [MVP]: "Re: NEWBIE: Pulling basic AD data"
- Next in thread: KWilliams: "Re: NEWBIE: Pulling basic AD data"
- Reply: KWilliams: "Re: NEWBIE: Pulling basic AD data"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|