Here is how I'm doing (translated from C#)
Dim de As DirectoryEntry = _
New DirectoryEntry("LDAP://celebris1/CN=Users,DC=celeb,DC=w2kdom,DC=com")
Dim mySearcher as DirectorySearcher = new DirectorySearcher(de)
mySearcher.Filter = "(samAccountName=administrator)"
mySearcher.PropertiesToLoad.Add("samAccountName")
mySearcher.PropertiesToLoad.Add("lastLogon")
Dim myResult as SearchResult
myResult = mySearcher.FindOne()
de = new DirectoryEntry(myResult.Path)
Dim pcoll as PropertyCollection = de.Properties
Dim li as LargeInteger
'PropertyValueCollection element 0 contains a COM IDispatch Pointer (__ComObject)
'Use late binding to retrieve the HighPart and LowPart properties, of the LastLogon
Date
Dim oli as object = pcoll("lastLogon")(0)
' Make it a Long and convert from FileTime format to DateTime
Dim lDate as Long = (oli.HighPart * &h100000000) + oli.LowPart
Console.WriteLine("DATE = {0:D}" ,DateTime.FromFileTime(lDate))
...
Willy.
----- Original Message -----
From: "Powell, Simon" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 18, 2002 3:24 PM
Subject: [DOTNET] Retrieving AD property values
> Does anyone know of how to retrieve "lastLogon" property value of a user
> account using VB.NET and the DirectoryServices class?
>
>
> ----------------------------------------------------------------------
> If you have received this e-mail in error or wish to read our e-mail
> disclaimer statement and monitoring policy, please refer to
> http://www.drkw.com/disc/email/ or contact the sender.
> ----------------------------------------------------------------------
>
> You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
> subscribe to other DevelopMentor lists at http://discuss.develop.com.
>
You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.