Security Basics mailing list archives
Re: Question about Active Directory and last time user has logged on
From: "Nikhil Wagholikar" <visitnikhil () gmail com>
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
Current thread:
- Question about Active Directory and last time user has logged on Mary Hendrix (Aug 28)
- RE: Question about Active Directory and last time user has logged on Quiroz, Genaro (GE, Corporate, consultant) (Aug 28)
- Re: Question about Active Directory and last time user has logged on Ali, Saqib (Aug 28)
- RE: Question about Active Directory and last time user has logged on Roger A. Grimes (Aug 29)
- RE: Question about Active Directory and last time user has logged on John Hammond (Aug 29)
- RE: Question about Active Directory and last time user has logged on CPS Tech Support (Aug 29)
- Re: Question about Active Directory and last time user has logged on Nikhil Wagholikar (Aug 30)
- <Possible follow-ups>
- Re: Re: Question about Active Directory and last time user has logged on jacques . itmagic (Aug 29)
- RE: Re: Question about Active Directory and last time user has logged on Roger A. Grimes (Aug 30)
- Re: Question about Active Directory and last time user has logged on jenna (Aug 30)
- RE: Question about Active Directory and last time user has logged on Osvaldo Casagrande (Aug 31)
- Re: Question about Active Directory and last time user has logged on Deno Vichas (Aug 31)
- Re: Re: Question about Active Directory and last time user has logged on djtim (Aug 31)
- Re: Re: Question about Active Directory and last time user has logged on jasonr_22 (Aug 31)
- RE: Re: Question about Active Directory and last time user has logged on Roger A. Grimes (Aug 31)