【发布时间】:2014-08-04 10:57:03
【问题描述】:
我正在寻找一种方法来检索所有在活动目录中没有分配管理员的用户。无论我尝试什么,它总是会吐出错误。
工作正常:
Get-ADUser -Filter {-not(lastLogonTimeStamp -like "*")} -Properties * -SearchBase "xxx"
不起作用:
Get-ADUser -Filter {-not(manager -like "*")} -Properties * -SearchBase "xxx"
Get-ADUser -Filter {manager -ne "*"} -Properties * -SearchBase "xxx
Get-ADUser -Filter {manager -eq $null} -Properties * -SearchBase "xxx
Get-ADUser -Filter {manager -notlike '*'} -Properties * -SearchBase "xxx
不使用whereclause,有人知道正确的语法吗?
解决方法:
Get-ADUser -SearchBase "xxx" -Filter * -Properties * | where {$_.manager -eq $null}
感谢你们的帮助。
【问题讨论】:
标签: powershell syntax active-directory