【问题标题】:LDAP query doesn't work when there is space in the OU当 OU 中有空间时,LDAP 查询不起作用
【发布时间】:2020-03-13 20:11:39
【问题描述】:

AD 中大约有 20 个 OU。 6 个 OU 中有空间。例如,“部门负责人”、“运营经理”。以下适用于没有空格的所有 15 个 OU,但在 OU 描述中有空格时不起作用。

任何想法。我尝试将字符串放入 "" 但没有任何帮助。

$LdapServer = "FLEX01AD.COLGATE.FILA"
$SearchBase = "OU=Department Heads,DC=COLGATE,DC=FILA"
$LDAPResult = Get-ADUser -SearchBase $searchbase -SearchScope 'subtree' -Server $ldapserver -filter "employeeID="U99YBTTXR" -Properties * | Select -Property userAccountControl, whenChanged

【问题讨论】:

  • 你需要引用它。这是一个 shell 问题,而不是 LDAP 问题。

标签: ldap ldap-query


【解决方案1】:

实际上,OU 中的空格不是问题。我在这里找到了解决方案

https://community.spiceworks.com/topic/2054880-powershell-count-unique-users-in-group-and-nested-group

这段代码对我有用

$LDAPResultCount = ($LDAPResult.userAccountControl | select -Unique).count

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多