dsquery - last logon
Posted on 2011-09-30
The following gives me the last logon time of a user. However, given the existence of products like “Real Last Logon”, my understanding is that the below query would need to be run on several domain controllers to get a accurate time.
dsquery * domainroot -filter "(&(objectCategory=Person)(objectClass=User)(sAMAccountName=%username%))" -attr sAMAccountName distinguishedName lastLogon
Can the dsquery tool target a specific domain controller to ease this burden?