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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

spQueryAD Active Directory SP error

Status
Not open for further replies.

bmcdermott

IS-IT--Management
Mar 27, 2009
1
US
This post references closed thread: thread183-1273100

Hi Folks,

I have been searching for a good way to run some reports from active directory and have found several solutions. One very helpful piece was posted by "notjustageek" in the above mentioned thread. This works great, except when I try and query on the bigint fields like 'lastLogon' or 'lastLogonTimestamp'. When I include those in the select, I get:

Create ADO connection...
done.
Set ADO connection to use Active Directory driver...
done.
Open the ADO connection...
done.
Create ADO command object...
done.
Set ADO command object to use Active Directory connection...
done.
Retrieve ADO command properties...
done.
Set 'PageSize' property...
done.
Set 'SearchScope' property...
done.
Set 'Asynchronous' property...
done.
Create the temporary ADO recordset for query output...
done.
Input the LDAP query...
done.
Execute the LDAP query...
done.
Retrieve the LDAP query results...

(1 row(s) affected)
Msg 0, Level 11, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.

so this works fine:

exec spQueryAD
'SELECT sn
FROM ''LDAP:// DC=domain,DC=biz''
WHERE objectCategory=''person'' and objectclass=''user'' and sn=''McJones''', 1

This does not:

exec spQueryAD
'SELECT sn, lastLogon
FROM ''LDAP:// DC=domain,DC=biz''
WHERE objectCategory=''person'' and objectclass=''user'' and sn=''McJones''', 1

Is there anything about the ADO recordset that would prevent lastLogon from being returned?

Any help would be greatly appreciated.
Thanks,
Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top