FengShui1998
MIS
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="adovbs.inc" -->
</head>
<body class="body">
TEST
<%
Set Container = GetObject("GC:"
For each Obj in Container
Set GC = Obj
Next
ADsPath = GC.ADsPath
' Query based on Employee ID
SQLStmt = "Select cn, distinguishedName, EmployeeID, homeMDB, SamAccountName," & _
"Mail, legacyExchangeDN, whenChanged, whenCreated, proxyAddresses From '" & _
ADsPath & "' WHERE objectCategory='person' AND objectClass='user' AND EmployeeID = " & _
"'" & "29316" & "'"
Set con = CreateObject("ADODB.Connection"
con.Provider = "ADsDSOObject"
con.Open
Set conCommand = CreateObject("ADODB.Command"
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("mail"
rs.movenext
ElseIf rs("homeMDB"
homeMDB = rs("homeMDB"
response.write rs("homeMDB"
exit do
Else
rs.movenext
End If
Loop
Else
homeMDB = "Not found"
End If
%>
Thanks for any help.
fengshui_1998