Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

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

$
0
0

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


Viewing all articles
Browse latest Browse all 13067

Trending Articles