Export the last user logon time across multiple domain controllers RRS feed

  • General discussion

  • Guys, Help!

    Im a complete newbie at this whole thing, so go easy!

    Im looking to export a list off all my users login times across multiple domain controllers.

    I've managed to do this partially with code:

    Dsquery * -limit 0 -filter "&(objectClass=User)(objectCategory=Person)" -attr sAMAccountName lastlogontimestamp  useraccountcontol >>Export.txt

    but as far as i can tell, this is just 1 controller.

    is there anyway i can pipe the others into it?

    • Changed type Bill_Stewart Tuesday, April 14, 2020 5:04 PM
    • Moved by Bill_Stewart Tuesday, April 14, 2020 5:04 PM Unanswerable drive-by question
    Tuesday, October 29, 2019 2:44 PM

All replies

  • What's the purpose?

    As you have noticed, the lastLogon attribute is not replicated between domain controllers.

    However, lastLogonTimestamp is replicated.

    -- Bill Stewart [Bill_Stewart]

    Tuesday, October 29, 2019 3:00 PM
  • The Gallery contains numerous scripts that do this.


    Tuesday, October 29, 2019 3:01 PM