Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADSI

Status
Not open for further replies.
Apr 27, 1999
705
0
0
US

Hi,

I'm trying to query our Global Catalog server using ADSI.
I wrote a script that runs ok in vbscript. However when I port it to an ASP page it, I get the following.


Provider error '80004005'

Unspecified error

The code is below:

<!-- #include file=&quot;adovbs.inc&quot; -->
</head>
<body class=&quot;body&quot;>
TEST
<%
Set Container = GetObject(&quot;GC:&quot;)
For each Obj in Container
Set GC = Obj
Next
ADsPath = GC.ADsPath

' Query based on Employee ID
SQLStmt = &quot;Select cn, distinguishedName, EmployeeID, homeMDB, SamAccountName,&quot; & _
&quot;Mail, legacyExchangeDN, whenChanged, whenCreated, proxyAddresses From '&quot; & _
ADsPath & &quot;' WHERE objectCategory='person' AND objectClass='user' AND EmployeeID = &quot; & _
&quot;'&quot; & &quot;29316&quot; & &quot;'&quot;

Set con = CreateObject(&quot;ADODB.Connection&quot;)
con.Provider = &quot;ADsDSOObject&quot;
con.Open
Set conCommand = CreateObject(&quot;ADODB.Command&quot;)
Set conCommand.ActiveConnection = con
Set rs = con.Execute(SQLStmt)
If rs.recordcount > 0 Then
' Information may not be in the first record
rs.movefirst
Do While NOT rs.eof
If instr(rs(&quot;mail&quot;), &quot;zz&quot;) = 1 then ' Ignore old mailboxes
rs.movenext
ElseIf rs(&quot;homeMDB&quot;) <> &quot;&quot; then
homeMDB = rs(&quot;homeMDB&quot;)
response.write rs(&quot;homeMDB&quot;)
exit do
Else
rs.movenext
End If
Loop
Else
homeMDB = &quot;Not found&quot;
End If

%>

Thanks for any help.

fengshui_1998
 
Well, I don't fully understand what you are doing but I'm pretty sure ASP cannot handle this line:

Set Container = GetObject(&quot;GC:&quot;)

There is no GetObject() function or method in ASP that I know of.

If you're working with a SQLServer database you might have better luck working through a stored procedure.

HTH
Falcon


 
Did you get a solution to this problem. I am writing a similar ASP page now and am getting the same error. My error occurs at the .execute command. Just seeing if there is a solution. Thanks.
 
I have isgten's problem.
There is an error at the "execute" command
I've heardn that it could be an IIS configuration problem.

Has anyone figured this out?

Thanks a lot,
Rikki
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top