Look up when password was last set
- From: Joe V <jnv0529@xxxxxxxxx>
- Date: Mon, 19 May 2008 13:37:30 -0700 (PDT)
Hello,
I'm writing a script to look up user account info from AD and I'm
having a problem with getting when the password was last set.
------------
'On Error Resume Next
strUsername = "username"
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.CommandText = "SELECT Name, whenCreated, pwdLastSet FROM
'LDAP://dc=corp,dc=acme,dc=local' WHERE objectCategory='user' " & "AND
sAMAccountName='" & strUsername & "'"
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
Wscript.Echo "Name: " & objRecordSet.Fields("Name").Value
Wscript.Echo "Created: " &
objRecordSet.Fields("whenCreated").Value
Wscript.Echo "Pasword set: " &
objRecordSet.Fields("pwdLastSet").Value
objRecordSet.MoveNext
Loop
------------------------------------
Name and whenCreated come up just fine. But pwdLastSet I get an
error.
Line: 21, Char: 5, Error: Object doesn't support this property method,
Code: 800A01B6
Anyone know why I'm getting this error?
Thanks,
Joe
.
- Follow-Ups:
- Re: Look up when password was last set
- From: Richard Mueller [MVP]
- Re: Look up when password was last set
- Prev by Date: Re: "Select * from Win32_Product" Not Finding All Apps
- Next by Date: Re: Look up when password was last set
- Previous by thread: There is no such object on the server
- Next by thread: Re: Look up when password was last set
- Index(es):
Relevant Pages
|
|