Get-ADUser Filter on WhenCreated works for -lt but not -gt

断了今生、忘了曾经 提交于 2021-02-07 08:20:04

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!