CSVDE filter

Discussion in 'Scripting' started by Fat Frog, Jan 19, 2010.

  1. Fat Frog

    Fat Frog Guest

    Hello,

    I use csvde.exe to query Active Directory user's first name, last name,
    logon name. The result gives me 2000 entries of all users in the domain, but
    I only need less than 100 of them that were created since, say, last month.
    I am wondering how I would put a filter on the -L of CSVDE.

    I run it like this:
    csvde -d "ou=DomainUsers,DC=domain,DC=org" -r objectClass=user -L
    "sAMAccountName,givenName,sn,whenCreated"

    The query result listed under the LDAP label of whenCreated is in the format
    of 20100112172907.0Z ("2010-01-12 17:29:07 0Z could be time zone
    designation).

    It doesn't matter to filter according to the value of numbers or the past
    dates, I just need the result that only contains the newly added active
    directory users.

    Thanks and regards.
     
    Fat Frog, Jan 19, 2010
    #1
    1. Advertisements

  2. You can include a whenCreated clause in your filter. For example (watch line
    wrapping):

    csvde -d "ou=DomainUsers,DC=domain,DC=org" -r
    "(&(objectCategory=person)(objectClass=user)(whenCreated>=20100101000000.0Z))"
    -L "sAMAccountName,givenName,sn,whenCreated" -f report.csv

    The form of the clause is:

    (whenCreated>=yyyymmddhhmmss.0Z)

    I believe the ">" operator is not supported, so use ">=". I added the
    objectCategory clause to eliminate computer objects (which also are class
    user). The ".0Z" will be UTC (what used to be called GMT).
     
    Richard Mueller [MVP], Jan 19, 2010
    #2
    1. Advertisements

  3. Fat Frog

    Fat Frog Guest

    Thank you so much! The result is exactly what I am looking for.
     
    Fat Frog, Jan 19, 2010
    #3
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.