Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exporting AD Computer accounts from a given day onwards

Status
Not open for further replies.

beefstew

Technical User
Oct 27, 2002
124
GB
Hi all,

Has anyone any info on the above please? Basically need to do an LDAP export of all Servers that have been joined to the forest from a given date onwards.

I'm guessing the creteTimeStamp attribute comes into it somewhere, but i'm not too sure how to write the LDAP qeury.

Any help gladly appreciated.

Thanks
 
For a starting point on LDAP filters, try this: faq774-5667

You're question is interesting, because I've never had to query a "UTC Coded Time" attribute. (at least not that I can remember) So I pulled a book off my shelf and it gave me the exact answer...

QUOTE:
[tt]Generalized Time String. The form of the value in a filter is either "YYYYMMDDHHMMSS.0Z" or "YYYYMMDDHHMMSS.0[+/-]HHMM". The "Z" in the former form means "no time differential"; that is, the time is in GMT/UTC time. The latter form includes a time zone differential to GMT/UTC. For example, Finland is 2 hours ahead of GMT/UTC. If you want to list objects that were created on or after February 26, 2001, 3:20PM (local time), you would use the filter (whenCreated>=20010226132000.0+0200). The same filterusing the GMT/UTC time would be (whenCreated>=20010226132000.0Z). (S. Kouti, M. Seitsonen, Inside Active Directory: An administrator's guide, 2nd Ed. (Addison-Wesley, 2005), 607-608)[/tt]

From this lesson, we can quickly build an LDAP filter to find all computers created since 1/1/2008:
(&(objectClass=computer)(whenCreated>=20080101000000.0Z))

We can then take this filter and put it into LDIFDE or CSVDE and extract the data from AD:

ldifde -f dump.txt -r "(&(objectClass=computer)(whenCreated>=20080101000000.0Z))" -l "whenCreated"


PSC

Governments and corporations need people like you and me. We are samurai. The keyboard cowboys. And all those other people out there who have no idea what's going on are the cattle. Mooo! --Mr. The Plague, from the movie "Hackers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top