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

Get password last set date from AD

Status
Not open for further replies.

sqldba7

IS-IT--Management
Dec 4, 2009
2
US
thread183-1273100

I am using sp_QueryAD to query AD. I am able to get the following info with no problem.

SELECT cn, mail, sAMAccountName, userAccountControl, adspath
FROM ''LDAP://server.com''
WHERE objectCategory = ''Person''
AND objectClass = ''user''
order by mail

I need to get the last password set date for each login. I do not know the column name to pass in the SELECT clause to get the last password change date. Can anyone enlighten me with this.

I have tried pwdLastSet, passwordExpires etc on the SELECT clause and it does now work. Any help would be appreciated.
 
Where is your OPENQUERY?
Both examples include it:
Code:
select *
 from [COLOR=red]openquery
(
ADSI,'SELECT cn, mail, sAMAccountName, userAccountControl
FROM ''LDAP://domain.com''
WHERE objectCategory = ''Person''
AND objectClass = ''user''
order by mail
'
) [/color]

Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
 
I am not using openquery. I am using the sp_queryAD from the linked forum article. This sp_queryAD uses sp_oacreate using ADsDSOObject. thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top