Ethical Hacking

Learn to find vulnerabilities before the bad guys do! Gain real world hands on hacking experience in our state of the art hacking lab. Course designed and taught by expert instructors with years of penetration testing experience. 12 student maximum in every class. Certification attempt included in every package.
Computer Forensics Training at InfoSec Institute

Gain the in-demand skills of a certified computer examiner, learn to recover trace data left behind by fraud, theft, and cybercrime perpetrators. Discover the source of computer crime and abuse at your organization so that it never happens again. All of our class sizes are guaranteed to be 12 students or less to facilitate one-on-one interaction with one of our expert instructors.




Network Security Security-Basics
[Top] [All Lists]

Re: Question about Active Directory and last time user has logged on

Subject: Re: Question about Active Directory and last time user has logged on
Date: Thu, 30 Aug 2007 10:23:23 +0530
Hello Mary Hendrix,

Here is a useful stuff I found on Google search:

Here is a small bit of VBScript which using the Windows Scripting
engine can be used to generate a list of all user last logons (if the
last logon time is not available the user will be omitted):

Save the following text into file userlogin.vbs

' List last logon times
' 2001-03-27 John Savill, Jakob Hussfelt http://www.ntfaq.com
On Error Resume Next
sEnterDCs = "SAVILLTECH,SAVILLNT02"
sObjects = Split(sEnterDCs, ",")
Set oDomain = GetObject("WinNT://" & sObjects(0))
oDomain.Filter = Array("User")
WScript.Echo "Showing last login times of accounts from: " &
oDomain.Name & vbNewLine
For Each oDomainItem In oDomain
  sUsrLogin = oDomainItem.LastLogin
  If UBound(sObjects) >= 1 Then
    For ii = 1 To UBound(sObjects)
      Set oUsr = GetObject("WinNT://" & sObjects(ii) & "/" &
oDomainItem.Name & ",user")
      If oUsr.LastLogin > sUsrLogin Then sUsrLogin = oUsr.LastLogin
    Next
  End If
  WScript.Echo "Username: " & Left(oDomainItem.Name & Space(22),22) &
"Last login: " & FormatDateTime(sUsrLogin)
Next

In line 'set oDomain = GetObject("WinNT://SAVILLTECH")' you should
change SAVILLTECH to your domain name.

To run type the following:

C:\> cscript userlogin.vbs

You can also use USRSTAT.EXE from the resource kit.

More Information:
http://www.windowsitpro.com/Articles/ArticleID/15113/15113.html?Ad=1

-----
Nikhil Wagholikar
Information Security Analyst
NII Consulting
Web: http://www.niiconsulting.com



On 8/29/07, Mary Hendrix <maryhendrix@gmail.com> wrote:
Is there a way to find out the last time a user has logged into a domain?

Thanks in advance

Mary


<Prev in Thread] Current Thread [Next in Thread>