LastLogOff Property giving error

  • Thread starter Thread starter Sunil B.G.
  • Start date Start date
S

Sunil B.G.

Hi

I'm trying to access the user property lastlogoff
the adsurl is

WinNT://domainname/username,user and
WinNT://domaincontrollermachine/username,user

the src is

Dim usr As IADsUser
Set usr = GetObject(adsurl)

while accessing lastlogin, there are no issues, but while accessing
lastlogoff I get
The Active Directory property cannot be found in the cache

Any solutions for this.

thx. in advance
-unil
 
Not all properties are supported by WinNT provider. Try using this one

Set objRootDSE = GetObject("LDAP://rootDSE")
WScript.Echo objRootDSE.Get("defaultNamingContext")
Set User = GetObject("LDAP://cn=usercn,ou=userou," &
objRootDSE.Get("defaultNamingContext"))
WScript.Echo User.LastLogoff

lastLogoff is never populated and always null (1.1.1600). Also together with
lastlogoff attribute they are not replicated among DC's, so you have to
query each DC in the domain, to get an accurate value.

--
Regards

Matjaz Ladava, MCSE (NT4 & 2000), Windows MVP
(e-mail address removed)
http://ladava.com
 
Back
Top