| 
| 
| 
| #189092 - 2008-08-12 09:31 PM  Error using fnLDAPQuery |  
| Glenn Barnas   KiX Supporter
 
       
   Registered:  2003-01-28
 Posts: 4401
 Loc:  New Jersey
 | 
I'm trying the following code to determine when a user last changed their password:
 
; LDAPQuery(WHAT, [FROM], [FILTER], [ORDER BY], [SCOPE], [USER], [PASSWORD]) 
$aData = fnLDAPQuery('pwdLastSet', 'LDAP://CN=TestUser,CN=Users,DC=corporate,DC=libgo', '(objectClass=User)')
@SERROR ?
UBound($aData) ' elements' ?
For Each $ in $aData
 $ ?
Next
I am specifying a valid user name in "Last\, First" format. If my "WHAT" is "Name", it works, but if I try the "pwdLastSet", I get an IDispatch Pointer error. According to MSDN, it's supposed to return a large int, holding the number of ms since 1/1/1601. I can't figure out why I'm getting the IDispatch Pointer error - anyone have any ideas?
 
 Thanks,
 
 Glenn
 
 PS - this is Christopher Shilt's "fnLDAPQuery"
 
_________________________Actually  I am  a Rocket Scientist!    |  
| Top |  |  |  |  
| 
| 
| #189096 - 2008-08-13 12:43 AM  Re: Error using fnLDAPQuery
[Re:  NTDOC] |  
| Allen   KiX Supporter
 
       
 Registered:  2003-04-19
 Posts: 4562
 Loc:  USA
 | 
Wasn't me...     |  
| Top |  |  |  |  
| 
| 
| #189097 - 2008-08-13 07:11 AM  Re: Error using fnLDAPQuery
[Re:  Glenn Barnas] |  
| Kdyer   KiX Supporter
 
       
   Registered:  2001-01-03
 Posts: 6241
 Loc:  Tigard, OR
 | 
Glenn,
 I think you might gain some clarity here:
 
 http://www.tek-tips.com/viewthread.cfm?qid=913108&page=9
 
 I think what you are looking for is: objUser.PasswordLastChanged
 
 HTH,
 
 Kent
 
 Edited by Kdyer (2008-08-13 07:12 AM)
 |  
| Top |  |  |  |  
| 
| 
| #189101 - 2008-08-13 03:12 PM  Re: Error using fnLDAPQuery
[Re:  Allen] |  
| ChristopheM   Hey THIS is FUN
 
       
 Registered:  2002-05-13
 Posts: 311
 Loc:  STRASBOURG, France
 | 
The problem is that vartype for pwdLastSet is "object". This is why you have iDispatch error.I have made some changes in your code to test :
 
 
break on
 
$aData = GetLastPwdSetList(
	"LDAP://CN=TestUsers,CN=Users,DC=xxx,DC=xxx",	; from where
	"&(objectClass=User)"				; filter
)
@SERROR ?
(UBound($aData,1)+1) ' elements' ?
for $i=0 to UBound( $aData,1 )
    $objUser = GetObject( "LDAP://"+$aData[$i,0] )
    $objUser.GetInfo()
    $objUser.distinguishedname+chr(9)+
    $objUser.displayname+chr(9)+
    $objUser.PasswordLastChanged ?
Next
 
Function GetLastPwdSetList($sFrom, $sFilter)
	Dim $sWhat, $sScope, $Request
 
	$sWhat = "distinguishedname"
	$sScope = "SubTree"
	$Request = fnLDAPQuery($sWhat, $sFrom, "("+$sFilter+")", , $sScope)
	if @error	exit @error	endif
 
	$GetLastPwdSetList=$Request
	Exit 0
EndFunction
In the function, i request for distinguishedName property (not pwdLastSet).
 Then, with the distinguishedName, i create an object and i read properties.
 Finally, i display distinguishedname, displayname and pwdLastSet.
 
 I think this is what you tried to do.
 
_________________________Christophe
 |  
| Top |  |  |  |  
| 
| 
| #189107 - 2008-08-14 04:06 AM  Re: Error using fnLDAPQuery
[Re:  ChristopheM] |  
| NTDOC   Administrator
 
       
   Registered:  2000-07-28
 Posts: 11627
 Loc:  CA
 |  |  
| Top |  |  |  |  
 Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
 
 | 
| 
 
| 0 registered
and 739 anonymous users online. 
 | 
 |  |