OK.. I am not really good at asking questions, but the title says it all. I got my script querying Active Directory to work when called from the command windows, but it won't work on my ASP page. Instead of echo("message")
in the VBS file, I used
Response.Redirect(message)
in my ASP. So here's the code that is working fine in the CMD window, but not in IE. Anyway, I hope someone can help.
Option Explicit
Dim objRootDSE, strDNSDomain, objCommand, objConnection
Dim strQuery, strBase, strFilter, strAttributes
Dim objRecordSet, strAlias, strName, strSAM
Dim blnFlag
''// Use ADO to search Active Directory.
Set objCommand = CreateObject("ADODB.Command")
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
objCommand.ActiveConnection = objConnection
''// Set AD query propeties
strBase = "<LDAP://10.10.10.10>"
strFilter = "(&(objectCategory=person)(objectClass=user)(cn="gossmari")"
strAttributes = "displayName,mailNickname,sAMAccountName"
''// AD query
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
objCommand.CommandText = strQuery
objCommand.Properties("Page Size") = 100
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute
Do Until objRecordSet.EOF
strName = objRecordSet.Fields("displayName")
strAlias = objRecordSet.Fields("mailNickname")
strSAM = objRecordSet.Fields("sAMAccountName")
objRecordSet.MoveNext
Loop
''// Echo the requested information
''// replaced by Response.Redirect("http://www.google.com/" & strName)
Wscript.Echo strSAM & " ; " & strAlias & " ; " & strName
objConnection.Close
edit : The error I keep getting is : An error occurred on the server when processing the URL. Please contact the system administrator. If you are the system administrator please click here to find out more about this error.
My computer is running windows vista and I'm really starting to hate it