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.
Re: dsquery for users last logon time???
The dsquery should be probably like this:
Quote:
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:
Quote:
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.
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.
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 ;-)
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.