Find AD computers created on a specific date (Without using Quest)


Does anyone have a way of finding AD computers created on a specific date, without using the quest AD snapin?

Currently, I use this simple little one liner… unfortunately I need to be able to do this without the third part snap-in.

Has anyone ever done this?

Get-QADComputer -CreatedOn $dateTimePicker1.Text | select SamAccountName, whenCreated

Many thanks

Can you use the Microsoft ActiveDirectory module, or are you limited to the System.DirectoryServices classes?

Either way, there is a “whenCreated” property that you can filter on. You’ll probably need to set up your filter as a range from midnight-to-midnight, as that field appears to contain time data. For example:

# Simulating what is probably in your $dateTimePicker1.Text field.
$textDate = '1/2/2014'

$startDate = ([datetime]$textDate).Date
$endDate = $startDate.AddDays(1)

Get-ADComputer -Filter 'whenCreated -ge $startDate -and whenCreated -lt $endDate' -Properties whenCreated |
Select-Object -Property SamAccountName,whenCreated

Hi Dave,

Thank you so much for this. This is perfect!

Many thanks