Finding new users

  • Thread starter Thread starter Peter C
  • Start date Start date
P

Peter C

Is there an easy way to list the user objects in a domain
created within a certain time frame, or at least to
extract some kind of list which would be sortable by the
date the object was created?

I've had a hunt around, but can't find any way to
acomplish this. Sorry if I've missed something
stupid/obvious.

Thanks,

PC
 
Is there an easy way to list the user objects in a domain
created within a certain time frame, or at least to
extract some kind of list which would be sortable by the
date the object was created?

I've had a hunt around, but can't find any way to
acomplish this. Sorry if I've missed something
stupid/obvious.

Thanks,

PC
Yes.
Using the Active Directory Command-Line tools, tip 6820 in the 'Tips & Tricks'
at http://www.jsiinc.com

You can modify the script at tip 7368, or

@echo off
If {%2}=={} @echo Syntax UserCreated FromYYYYMMDD ToYYYYMMDD&goto :EOF
setlocal
set fromdt=%1
set todt=%2
set qry=dsquery * domainroot -filter
"(&(objectCategory=Person)(objectClass=User))" -attr whenCreated
distinguishedName -Limit 0
REM the above 3 lines are 1 line
for /f "Skip=1 Tokens=1,2*" %%a in ('%qry%') do (
set whencdt=%%a
set Whenctm=%%b
set user=%%c
call :parse
)
endlocal
goto :EOF
:parse
set yyyymmdd=%whencdt:~6,4%%whencdt:~0,2%%whencdt:~3,2%
if "%yyyymmdd%" LSS "%fromdt%" goto :EOF
if "%yyyymmdd%" GTR "%todt%" goto :EOF
@echo %user% %whencdt% %whenctm%

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