You may also consider using command line LDAP tools, aduc really isn't that
great for doing things like this. Check out adfind on the free win32 c++ tools
of www.joeware.net.
joe
--
Joe Richards Microsoft MVP Windows Server Directory Services
www.joeware.net
ibnu wrote:
> Using Windows 2000's "Active Directories Users and Computers", how could I find or locate Objects (Users or Computers) based on the date that they were created or modified?
> For example, I want to locate all Computers that were created on May 30, 2004 and all Users that were modified on June 1, 2004.
>Using Windows 2000's "Active Directories Users and Computers", how could I find or locate Objects (Users or Computers) based on the date that they were created or modified?
>For example, I want to locate all Computers that were created on May 30, 2004 and all Users that were modified on June 1, 2004.
Using the Active DIrectory command line tools, tip 6820 in the 'Tips & Tricks'
at http://www.jsiinc.com
See tip 7992.
See tip 8006 for an example.
Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
Thanks again.
Again, thank you very much for the information.
Here are the modifications that I did, and since I am not familiar with scripting, I hope you are willing to point my mistakes.
First, I modified the script to list Users who were CREATED after a specified date:
@echo off
if {%1}=={} @echo Syntax: UserCreatedAfter YYYYMMDD&exit /b 1
setlocal
set after=%1
set query=dsquery * domainroot -filter "(&(objectClass=User))" -attr name whenCreated description -limit 0
for /f "Skip=1 Tokens=1-5* Delims=/ " %%c in ('%query%') do (
set name=%%c
set created=%%f%%d%%e
set description=%%h
call :checkdt
)
endlocal
exit /b 0
:checkdt
if "%created%" LEQ "%after%" goto :EOF
@echo %name% %created% %description%
When I ran the script, the list also showed Computers that were created after the specified date. Why is that? I thought I only need to change the objectClass=User
The list also showed Users in the following format:
FirstName 23LastName10 14:53:01 User's description.
FirstName 21LastName08 22:11:43 User's description.
FirstName 27LastName02 02:04:14 User's description.
FirstName 28LastName11 00:03:09 User's description.
FirstName 27LastName07 20:56:00 User's description.
When I used "Active Directory Users and Computers" to verify, I found out that the list showed Users who were MODIFIED after the specified date, regardless when the users were actually CREATED. Why is that?
Why is the LastName appears between the Day and Month?
The Time also does not match with the information in Object Tab of the User's Properties.
Secondly, I modified the script to list only Users who were MODIFIED after a specified date:
@echo off
if {%1}=={} @echo Syntax: UserModifiedAfter YYYYMMDD&exit /b 1
setlocal
set after=%1
set query=dsquery * domainroot -filter "(&(objectClass=User))" -attr name whenModified description -limit 0
for /f "Skip=1 Tokens=1-5* Delims=/ " %%c in ('%query%') do (
set name=%%c
set modified=%%f%%d%%e
set description=%%h
call :checkdt
)
endlocal
exit /b 0
:checkdt
if "%modified%" LEQ "%after%" goto :EOF
@echo %name% %modified% %description%
When I ran the script, the list also showed Computers that were created after the specified date. Why is that?
Along the list of Users who were MODIFIED after a specified date, the following lines appeared (I only include 2 of them here as samples):
'Mktg' is not recognized as an internal or external command, operable program or batch file.
'Comm.' is not recognized as an internal or external command, operable program or batch file.
I could not fine "Mktg" or "Comm" information in the "Active Directory Users and Computers". Where did those line come from?
Any tips that you can provide is greatly appreciated.
Ibnu.
"(&(objectcategory=person)(objectclass=user))"
or
"(&(objectcategory=person)(samaccountname=*))"
Also note that the way whencreated and whenchanged work, you can actually
specify them in the search filter so you only return objects created/modified
after the specified date like so:
"(&(objectcategory=person)(objectclass=user)(whencreated>=20040501000000.0Z))"
--
Joe Richards Microsoft MVP Windows Server Directory Services
www.joeware.net
On Fri, 2 Jul 2004 17:10:01 -0700, "ibnu" <ib...@discussions.microsoft.com>
Thank you very much for the information.....
Thank you very much for the information..... It was helpful.