使用 DirectorySearcher 出现奇怪的结果
我正在使用 DirectorySearcher
从公司 AD 服务器获取所有 AD 用户的显示名称,我们有大约 100k 记录,并且大多数结果都是正确的。
但是我们有近 100 个用户的显示名称是“$CimsUserVersion2”,这确实是一个奇怪的结果,我检查了 Outlook,它也从 AD 同步显示名称,名称是正确的
您是否遇到同样的问题?
多谢
using (var de = new DirectoryEntry("LDAP://" + domain))
{
using (var search = new DirectorySearcher(de))
{
search.Filter = "CN=" + userName;
var results = search.FindAll();
string temp = results[0].Properties["displayname"][0].ToString();
if (string.IsNullOrEmpty(temp))
{
return string.Empty;
}
else
{
return temp;
}
}
}
I am using DirectorySearcher
to get all AD users' display name from company AD server, we have around 100k records and most of results are correct.
But we got near 100 users' display name are "$CimsUserVersion2", it's really a odd result, I checked in outlook which also sync display name from AD, the name is correct
Have u facing same issue?
Thanks a lot
using (var de = new DirectoryEntry("LDAP://" + domain))
{
using (var search = new DirectorySearcher(de))
{
search.Filter = "CN=" + userName;
var results = search.FindAll();
string temp = results[0].Properties["displayname"][0].ToString();
if (string.IsNullOrEmpty(temp))
{
return string.Empty;
}
else
{
return temp;
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不确定这是否是问题所在 - 但我认为您需要告诉搜索者您希望加载
displayName
属性:Not sure if that's the problem - but I think you'd need to tell your searcher that you want the
displayName
attribute to be loaded:难道您不使用“Centrify DirectControl 将 UNIX 用户和组自动配置到 Microsoft Active Directory 中吗? ”。
该工具使用简单的对象模型来管理用户、组、计算机和区域的 UNIX 特定属性以及 UNIX NIS 服务。
据我了解,它使用 Active-Directory 属性来注册一些特殊信息。
UserVersion 映射到
displayName
:UserVersion 确定用户配置文件对象和 Centrify DirectControl 管理员控制台之间的兼容性。此属性的唯一有效值是 $CimsUserVersion2。
例如:
显示名称:$CimsUserVersion2
Don't you automate the provisioning of UNIX users and groups into Microsoft Active Directory with "Centrify DirectControl".
This tool uses a simple object model to manage the UNIX-specific properties for users, groups, computers, and zones, as well as UNIX NIS services.
As far as I understand it uses Active-Directory attributes to register some special informations.
UserVersion is map to
displayName
:UserVersion determines compatibility between a user profile object and the Centrify DirectControl Administrator Console. The only valid value for this attribute is $CimsUserVersion2.
For example:
displayName: $CimsUserVersion2