Query AD for users created within a certain amount of time

dmwdmw Member Posts: 81 ■■□□□□□□□□
Hi,

I am looking to query AD to find all users in an Ou who have been created in the last month. Anyone know which attribute can get me the last part - created date?

Thanks
Rebooting computers since 1999

Comments

  • royalroyal Member Posts: 3,352 ■■■■□□□□□□
    Well, I am currently at home and loaded up my Longhorn machine and checked out the newly created attribute editor. I see an attribute called whenCreated. Perhaps it's usable on Server 2003. Unfortunately, I can't check it out right now as I don't have access to a Server 2003 machine.

    testuserto6.gif
    “For success, attitude is equally as important as ability.” - Harry F. Banks
  • JdotQJdotQ Member Posts: 230
    icroyal wrote:
    Well, I am currently at home and loaded up my Longhorn machine and checked out the newly created attribute editor. I see an attribute called whenCreated. Perhaps it's usable on Server 2003. Unfortunately, I can't check it out right now as I don't have access to a Server 2003 machine.

    testuserto6.gif

    Just verified, and its the same on W2003/W2000 icon_cool.gif

    *EDIT*

    Just realized with icroyal's screenshot -- looks like with Longhorn they smashed together ADSI Edit with ADUC, nice! That'll make it a little bit easier, and one less MSC to open ;)
  • dmwdmw Member Posts: 81 ■■□□□□□□□□
    I don't see the atttribute tab. Windows 2003 R2 SP2?

    Do I need to add a reg key?
    Rebooting computers since 1999
  • royalroyal Member Posts: 3,352 ■■■■□□□□□□
    He was referring to the existence of the attribute in Server 2003 rather than the GUI displaying it. The Attribute Editor tab is a Longhorn only feature.
    “For success, attitude is equally as important as ability.” - Harry F. Banks
  • JdotQJdotQ Member Posts: 230
    Yes, I was just confirming the attribute also exists in 2000/2003.

    I grabbed the attribute via ADSI Edit
  • dmwdmw Member Posts: 81 ■■□□□□□□□□
    OK now I see. Lets see what I can do with that. I will report back.
    Rebooting computers since 1999
  • dmwdmw Member Posts: 81 ■■□□□□□□□□
    Not done yet but I don't see a way this can be done with either dsquery or dsget.
    Rebooting computers since 1999
  • royalroyal Member Posts: 3,352 ■■■■□□□□□□
    dmw wrote:
    Not done yet but I don't see a way this can be done with either dsquery or dsget.

    It can't be. You'll have to script it or get someone to script it for you. As I am not a scripter, there are others on this forum that might be able to help you out. Also, there are plenty of vbscripting forums that might be able to help you out with what you need.
    “For success, attitude is equally as important as ability.” - Harry F. Banks
  • doom969doom969 Member Posts: 304
    Just a thought,
    Cant you use csvde with a filter for the attribute username and whencreated ?
    Or use ldifde and parse the file ?
    not sure if its possible, i might try it icon_eek.gif

    Doom969
    Doom969
    __________________________________________________________
    MCP (282 - 270 - 284 - 290 - 291 - 293 - 294 - 298 - 299 - 350)
    MCTS (351 - 620 - 622 - 647 - 649 - 671)
    MCSA / S / M - MCSE / S
    MCITP (EST - EA ) - MCT
    A+ - IBM - SBSS2K3 - CISCO_SMB
    CompTIA : A+
  • dmwdmw Member Posts: 81 ■■□□□□□□□□
    Just a thought, doesn't it seem like this should be something that could be done pretty easily?

    Anyways, anyone familar with the tool adfind. I started using it and it looks like I can get the info exported to a text file pretty easily. Both the whencreated and the createtimestamp.

    Not bad
    Rebooting computers since 1999
  • JdotQJdotQ Member Posts: 230
    dmw wrote:
    Just a thought, doesn't it seem like this should be something that could be done pretty easily?

    Anyways, anyone familar with the tool adfind. I started using it and it looks like I can get the info exported to a text file pretty easily. Both the whencreated and the createtimestamp.

    Not bad
    Good call dmw.

    The ADFind tool can be downloaded for free from http://www.joeware.net/freetools/tools/adfind/index.htm
  • dmwdmw Member Posts: 81 ■■□□□□□□□□
    So adfind is the answer for and I see myself using this alot more as I get to learn it.

    The command I used to pipe this directly to a csv file which I could then manipulate how I needed.

    adfind -b ou=yourou,dc=yourdomain,dc=com -f "objectcategory=user" cn
    whenCreated -tdcgt -csv > whencr.csv

    The tdcgt formats the date/time stamp into a human readable form. Also there are forums for adfind here:

    http://www.joeware.net/myforum/viewforum.php?f=2&sid=cbe892191819188d682b2e5c2b2e2fd0
    Rebooting computers since 1999
Sign In or Register to comment.