问题
I am trying to search for users created after a specified date, but it always returns no results. If I change the -gt/ge to -lt/le it pulls results correctly, so this should be doable. I know I can just filter for all and then do a Where-Object to filter for gt/ge but I really need the filter to happen server side.
Any ideas on how to make this successful without doing Where-Object or using the Get-QADUser?
Update 2015.01.23: Not always getting this error, but it help point to the issue: Get-ADUser : This operation returned because the timeout period expired
$Today = Get-Date -year (Get-Date).Year -Month (Get-Date).Month -Day (Get-Date).Day -Hour 00 -Minute 00 -Second 00
$StartDate = $Today.AddDays(-3)
$inputProperties = @(
"samaccountname"
"employeeid"
"title"
"enabled"
"manager"
"whencreated"
)
Get-ADUser -Filter {(whencreated -ge $StartDate)} -Properties $inputProperties
来源:https://stackoverflow.com/questions/34941610/get-aduser-filter-on-whencreated-works-for-lt-but-not-gt