How do I find new Active Directory accounts that have been made in the last 90 days?

Solution 1:

For posterity, dsquery is designed for this kind of search. AD does keep a 'whenCreated' field, which makes it easy to search with your tool of choice.

dsquery * -filter "(whenCreated>=20101022083730.0Z)"

As an example. You can programatically create the timestring based on now - 90days.

Solution 2:

Try the following to pull users created in the last 30 days.

Get-ADUser -Filter * -Properties whenCreated | Where-Object {$_.whenCreated -ge ((Get-Date).AddDays(-30)).Date}

Solution 3:

An alternative to the Powershell version shown above, that is much more efficient because it does not load all users in memory before filtering them (you should do the filter on the Get-ADUser cmdlet directly and not use a Where-Object):

$now = ((Get-Date).AddDays(-90)).Date
Get-ADUser -Filter {whenCreated -ge $now}

Solution 4:

Using PowerShell and the Quest ActiveRoles Tools for AD (found here - http://www.quest.com/powershell/activeroles-server.aspx) ,

Get-QADUser -CreatedAfter (Get-Date).AddDays(-90)

will give you output to the console or wherever you redirect of all users created in the last 90 days.