Sunday, July 12, 2009

LDAP Query for User Accounts Created Since a Specific Date

Just modify the date string to use the YYYYMMDDHHMMSS.0Z format. So, for June 1, 2009, you would specify "20090601000000.0Z"


(&(objectCategory=user)(whenCreated>=20090601000000.0Z))

10 comments:

  1. Awesome, thanks... this helped me so much!

    ReplyDelete
  2. Awesome, thanks! Perfect!

    ReplyDelete
    Replies
    1. Oh totally!

      BTW, love the catch phrase on the header :)

      Delete
  3. I go looking for this information and am not surprised at all at who the OP is. Thanks Dave!

    ReplyDelete
  4. I go looking for this specific bit of information and am not surprised at who the OP is. Thanks Dave!

    ReplyDelete
  5. It worked! Is there a way to export the query result to a text or csv?

    ReplyDelete

  6. $Ldate = New-Object System.DateTime(2017,3,1)

    Get-ADUser -Properties name,distinguishedName,whenCreated -Filter {(objectClass -eq "user") -and (whenCreated -ge $Ldate)} |
    ConvertTo-Csv -NoTypeInformation |
    Out-File "adusers.csv"

    ReplyDelete
  7. I'm not sure what you're asking. If they're deleted and you don't have them in a Recycle Bin then they're gone.

    ReplyDelete