【发布时间】:2017-05-24 21:23:08
【问题描述】:
我正在尝试搜索具有扩展架构的 LDAP 服务器(不是 Active Directory 服务器)。搜索返回结果,但没有返回来自扩展对象类(扩展 inetOrgPerson 对象)的扩展属性。我应该在以下 PS 脚本中添加什么来返回这些属性?
$ourServer="LDAP://myserver:9999"
$ourPath="/somedn"
$ourAuth = [System.DirectoryServices.AuthenticationTypes]::FastBind
$Domain = New-Object System.DirectoryServices.DirectoryEntry ($ourDN,"usersfulldn","password",$ourAuth)
$ourSearcher=New-Object System.DirectoryServices.DirectorySearcher
$ourSearcher.filter="(mail=someone@somewhere.com)"
$ourSearcher.PropertiesToLoad.Add("*")
$ourSearcher.PropertiesToLoad.Add("mycustomattribute")
$ourUser=$ourSearcher.FindAll()
$ourUser.Properties
它为我提供了所有属性,但仅来自 inetOrgPerson 类。我已经查看了有关此主题的问题,但其中一些问题涉及 Active Directory,而不是其他 LDAP 服务器。
【问题讨论】:
-
我最终调用了应用程序(身份管理器的)Web 服务来获取这个额外的属性值,但是如果有人可以通过本机 PS 调用提供解决方案的见解,那就太好了
-
如果你只把
$ourSearcher.PropertiesToLoad.Add这两行注释掉,你有这个条目的所有属性吗?
标签: windows powershell ldap schema