Results 1 to 5 of 5

Thread: dsquery for users last logon time???

  1. #1
    Join Date
    Nov 2004
    Posts
    47

    dsquery for users last logon time???

    Hope you guys understood from my Subject line what I want to know. I have already tried searching for the same on web but dint found a working solution. So if anyone of you have any idea about any dsquery parameters to find out the last time a user was
    logged on, please let me know as well.

    Thanks for the helps.

  2. #2
    Join Date
    Sep 2004
    Posts
    150

    Re: dsquery for users last logon time???

    The dsquery should be probably like this:

    C:\>dsquery * "cn=paul williams,ou=test,dc=2k3dom,dc=com" -scope base -attr
    lastLogonTimestamp
    However, that value isn't very readable. You'd be better off using something like this VB Script:

    Set objUser = GetObject("LDAP://cn=Ken Myer, ou=Finance, dc=fabrikam,
    dc=com")
    Set objLastLogon = objUser.Get("lastLogonTimestamp")

    intLastLogonTime = objLastLogon.HighPart * (2^32) + objLastLogon.LowPart
    intLastLogonTime = intLastLogonTime / (60 * 10000000)
    intLastLogonTime = intLastLogonTime / 1440

    Wscript.Echo "Last logon time: " & intLastLogonTime + #1/1/1601#
    See if it helps.

  3. #3
    Join Date
    Nov 2004
    Posts
    47

    Re: dsquery for users last logon time???

    I appreciate your help friend but when i tried running the same it gives me the following error message:

    You are connected to a domain that does not support this query.

    Now What? I just want an easiest command that can display user account
    activity. Thanks again.

  4. #4
    Join Date
    Jan 2006
    Posts
    4,224

    Re: dsquery for users last logon time???

    No problem. A lot of people asked for it, so we got it. I just wish I could use it; but almost all of our customers are running 2000/ NT ;-)

  5. #5
    Join Date
    Oct 2005
    Posts
    2,358

    Re: dsquery for users last logon time???

    As far as i know the command you are trying to run needs Windows Server 2003 domain in domain functional mode.

Similar Threads

  1. Replies: 2
    Last Post: 30-04-2009, 09:45 PM
  2. Remote Web Workplace Will not Allow Users to Logon
    By Victor Kam in forum Small Business Server
    Replies: 5
    Last Post: 18-04-2009, 03:11 AM
  3. DSQUERY: list users created after a specific date
    By AndieB in forum Active Directory
    Replies: 2
    Last Post: 27-11-2008, 12:05 AM
  4. List of Last Logon Time with dsget/dsquery
    By Viensterrr in forum Active Directory
    Replies: 1
    Last Post: 17-09-2008, 05:36 PM
  5. users' last-logon-timestamp
    By HenrikK in forum Active Directory
    Replies: 4
    Last Post: 06-03-2008, 09:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •