【发布时间】:2021-03-19 10:31:58
【问题描述】:
我想知道我写的不正确。我需要获取由 10-20 个 OU 组成的具有相同名称 OU=NEEDOU 的所有用户。来自某个数据库。
Get-ADUser -Filter * -Properties DisplayName -SearchBase "OU=neededOU,OU=Mysearchbase,DC=randomname"| 其中 {$_.distinguishedname -like 'OU=NEEDOU*'}
【问题讨论】:
-
Get-ADUser -Filter "DistinguishedName -like '*OU=NEEDOU*'" -Properties DisplayName -
@Theo DN 不能这样过滤。
-
@filimonic 啊,我忘了..
DistinguishedName是一个构造属性,并且只允许使用-eq运算符..
标签: windows powershell