Active Directory Reporting

  • Thread starter Thread starter Jeff Syring
  • Start date Start date
J

Jeff Syring

I am looking for a reporting utility that I can get last
login and last log off times for a user. I have 3 domain
controllers in my domain so it must search all 3 for last
log off time. Any ideas?????
 
I have a report that scans all dc's in the domain and report the last logon
time. It is written in vb script and the output is a semi-colon separated
report that you can then import into Excel. If interested just e-mail me.
 
I am looking for a reporting utility that I can get last
login and last log off times for a user. I have 3 domain
controllers in my domain so it must search all 3 for last
log off time. Any ideas?????

Using the Active Directory command-line tools, tip 6820 in the 'Tips & Tricks'
at http://www.jsiinc.com

call LastLogOnOff UserName on off


@echo off
if {%3}=={} @echo Syntax: LastLogOnOff UserName on off&goto :EOF
setlocal
set user=%1
set qry=dsquery * domainroot -filter
"(&(objectCategory=Person)(objectClass=User)(sAMAccountName=%user%))" -attr
lastLogon lastLogoff -limit 0
REM The above 3 lines are 1 line
set on=0
set off=0
for /f "Tokens=*" %%s in ('dsquery server -O RDN') do (
for /f "SKIP=1 Tokens=1,2" %%a in ('%qry% -s "%%s"') do (
call :last %%a %%b
)
)
Call CvtFileTime %on% ondt
Call CvtFileTime %off% offdt
endlocal&set %2=%ondt%&set %3=%offdt%
goto :EOF
:last
if "%on%" LSS "%1" set on=%1
if "%off%" LSS "%2" set off=%2





Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top