Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8856411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:21:03+00:00 2026-06-14T14:21:03+00:00

Dear LotusScript Gurus, I am developing a Lotus Notes agent who should synch our

  • 0

Dear LotusScript Gurus,

I am developing a Lotus Notes agent who should synch our Windows 2003 AD with our Lotus Domino Directory (V 7.0.3 Server/Client).

I am using the ADODB.Connection and ADODB.Command processes to connect it and query the AD users.

This is the command text:

objCommand.CommandText = "<LDAP://ou=DMHU Users,dc=some,dc=kindof,dc=domain>;(&(objectCategory=person)(objectClass=user));name,lastLogon;subTree"

Then I would access the content of the field “lastLogon”:

objRecordSet.Fields("lastLogon").Value

but this is empty while the field “name” has the correct values (I know that the lastLogon field is a 64bit date – integer or so).

Using the same query e.g. in a VBScript receives the lastLogon content well.

Also using the SQL like query within the LotusScript code gives the same empty lastLogon value.

Does anybody have an idea?

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T14:21:04+00:00Added an answer on June 14, 2026 at 2:21 pm

    Finally I have found the solution.

    To access the lastLogon (and so kind AD variables) first of all an object has to be set which receives the current AD user object:

    Set objUser = GetObject(rs.Fields("adspath").Value)
    
    ...
    

    then the lastLogon has to be set as an object, as well:

    Set objLastLogon = objUser.Get("lastLogonTimeStamp")
    

    This OLE object will have a HighPart and a LowPart member. Using that members the last logon date and time can be calculated.

    This blog entry opened my eyes:
    http://sgwindowsgroup.org/blogs/badz/archive/2010/03/01/querying-for-the-lastlogontimestamp-attribute-of-all-users-in-an-ou.aspx

    Here is the function implemented by me which can receive the CN and lastLogonTimeStamp of a specific user.

    Sub getADUserLastLogon(sUser As String)
        Dim workspace As New NotesUIWorkspace
        Dim conn As Variant
        Dim sRoot As String
    
        sRoot = "LDAP://ou=USERS_OR_WHATEVER,dc=my,dc=domain"
    
        Set oConn = CreateObject("ADODB.Connection")
        oConn.Provider = "ADSDSOObject"
        oConn.Open "Ads Provider", "USERNAME", "SECRETPWD" ' open connection with specific user credentials
    
        Dim rs
        Set rs = oConn.Execute("<" & sRoot & ">;(&(objectCategory=person)(objectClass=user)(cn=" & sUser & "));" &_
        "adspath,distinguishedname,sAMAccountName,cn,mail,telephoneNumber,lastLogonTimeStamp;subtree")
    
        While Not (rs.EOF)
            On Error Resume Next
    
            Set objUser = GetObject(rs.Fields("adspath").Value)
    
            'Print "getting user: " & objUser.Get("cn")
    
            Set objLastLogon = objUser.Get("lastLogonTimeStamp")
    
            Dim intLastLogonTime As Double
    
            intLastLogonTime = (objLastLogon.HighPart * (2^32)) + objLastLogon.LowPart ' due to the 64 bit number
            intLastLogonTime = intLastLogonTime / (60 * 10000000) ' convert from 100nanosec to minutes
            intLastLogonTime = intLastLogonTime + 60 ' local timezone
            intLastLogonTime = intLastLogonTime / 1440 ' convert to hours
            intLastLogonTime = intLastLogonTime + Datenumber(1601,1,1)
    
            Call workspace.CurrentDocument.Document.ReplaceItemValue("txtADResult", _
            workspace.CurrentDocument.FieldGetText("txtADResult") & Chr(13) & _
            rs.Fields("cn").Value & " Last Logon: " & Format$(Cdat(intLastLogonTime), "yyyy.mm.dd. hh:nn:ss"))
    
            rs.MoveNext
        Wend
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Dear all,Now i have this question in my java program,I think it should be
Dear members of the Stackoverflow community, We are developing a web application using the
Dear all devexpress winform gurus:) My way is simple. First, i create a bindinglist:
Dear Masters of The Command Line, I have a directory tree for which I
Dear all trader and API Gurus, Thank you in advance. Background: Visual Studio 2010,
Dear Powershell Gurus, I have a few thousands of files in a folder called
Dear all, I am building an application on windows phone 7. My application needs
Dear folks, what should I do with these error warnings that Closure Compiler outputs?
. Dear Dev Guys :) I'm learning ASP.NET MVC3 and I'm stuck when I
Dear all, I have a question about Facebook Page: ( NOT user profile page,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.