search for computers that have been installed/reinstalled after a specific date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, I am looking for a way to search for the <modified> attribute on a lot of computers in AD

Q. How can I search for computers that have been installed/reinstalled after a specific date

I guess there is a way to find computers that are modified after a specific date by using a custom search, but I am not able to find out the proper LDAP query string to perform this search

Best regards Gunna
 
Hi, I am looking for a way to search for the <modified> attribute on a lot of computers in AD.

Q. How can I search for computers that have been installed/reinstalled after a specific date?

I guess there is a way to find computers that are modified after a specific date by using a custom search, but I am not able to find out the proper LDAP query string to perform this search.

Best regards Gunnar

You can use the Active Directory Command-line tools, tip 6820 in the 'Tips &
Tricks' at http://www.jsiinc.com, and the whenCreated attribute.

See tip 7992.

@echo off
set local
if {%1}=={} @echo Syntax ComputerAddedSince.bat yyyymmdd&goto :EOF
set sincedate=%1
set query=dsquery * domainroot -filter "(&(objectClass=Computer))" -attr name
whenCreated -limit 0
REM The above 2 lines are one line
for / f "Skip =1 Tokens=1*" %%a in ('%query%') do (
call :parse %%a %%b
)
endlocal
exit /b 0
:parse
set name=%1
set work=%2
set dt=%work:~6,4%%work:~0,2%%work:~3,2%
if "%dt%" LSS "%sincedate%" goto :EOF
@echo %name% %dt%


Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
Thanks for a quick reply. Is there a way to do this with pure VBS scripting
I am also very keen on how to enter the proper LDAP query string in the advanced custom search field in AD to find computers based on the <Modified> attribute.

Regards Gunna
 
Back
Top