Hello,
I'm modifying a web page to display all active directory computer
names along with their descriptions, os versions and service packs.
All of the values return correctly except "description". That value
returns a "type mismatch" error on the page.
If I comment out this line:
response.write "<br>Desc : "&description
Then it works fine.
It seems that "description" is multi-value and must be handled
differently then "name" and "operatingSystemVersion".
How would I modify the code accordingly?
Thanks
-----
<%Option Explicit%>
<HTML>
<BODY>
<%
Const ADS_SCOPE_SUBTREE = 2
dim objconnection
dim objcommand
dim objRecordSet
dim name
dim description
dim operatingSystemVersion
dim operatingSystemServicePack
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = _
"SELECT Name, description, operatingSystemVersion,
operatingSystemServicePack FROM 'LDAP://DC=domain,DC=com'" _
& " where objectClass='computer'"
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Timeout") = 30
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do While not objRecordSet.EOF
name=objRecordSet.Fields("Name").value
description=objRecordSet.Fields("description").value
operatingSystemVersion=objRecordSet.Fields("operatingSystemVersion").value
operatingSystemServicePack=objRecordSet.Fields("operatingSystemServicePack").value
response.write "<br>Name : "&name
response.write "<br>Desc : "&description
response.write "<br>OS : "&operatingSystemVersion
response.write "<br>SP : "&operatingSystemServicePack
response.write "<br>"
objRecordSet.MoveNext
Loop
'response.write objRecordSet.EOF
%>
</BODY>
</HTML>