Please Read: Significant Update Planned, Migrating Forum Software This Month

See more
See less

Export Active Dir

  • Filter
  • Time
  • Show
Clear All
new posts

  • Export Active Dir

    I'm trying to export inactive users and computers from active directory, and have it filterd to only show objects that were created longer than 6 months ago.
    I'm trying to set this up as a scheduled task so I'm hoping to have the date as a variable.

    I know it is possible to use:
    dsquery user -inactive 24 to show the users which have been inactive and the same for computers. But I dont know the switch to filter this to show accounts that were created more than 6 months ago

    csvde exports all of AD and I can see the whenCreated field but I dont know how to filter this down to just inactive users or user accounts which have been created more the 6 months.

    Is it possible to pipe these two or is there another tool?

  • #2
    Re: Export Active Dir

    dsquery * domainroot -filter "(&(objectcategory=person)(objectclass=user)(whenC reated>=200602010
    00000.0Z))" -attr distinguishedName sAMAccountName whenCreated

    and same with objectclass=computer

    you can also go to Joe's toolsand download AdFind
    to list users created after a specific date run something like this
    adfind -gc -b -f
    "&(objectclass=user)(ObjectCategory=person)(wh enCr eated>=20080101000000.0Z)"
    sAMAccountname, createTimeStamp

    this might require slight adjustments (I'm not in an AD environment at the moment so I can't test it)
    OneManITShop - IT Consultant
    eMail: [email protected]


    • #3
      Re: Export Active Dir

      Will have a look at that, thanks for the help