directoryentry - 给定用户的 SID,我如何获取 AD DirectoryEntry?

标签 directoryentry sid

我将用户的 SID 设为 byte[]windowsPrincipal.getIdentity().getSid() 内.
如何从 SID 获取 Active Directory 条目 (DirectoryEntry)?

最佳答案

我发现最简单的方法是使用 LDAP 绑定(bind)。类似于尼克吉尔斯所说的。更多信息请访问 MSDN

''' <summary>
''' Gets the DirectoryEntry identified by this SecurityIdentifier.
''' </summary>
''' <param name="id">The SecurityIdentifier (SID).</param>
<System.Runtime.CompilerServices.Extension()> _
Public Function GetDirectoryEntry(ByVal id As SecurityIdentifier) As DirectoryEntry
    Const sidBindingFormat As String = "LDAP://AOT/<SID={0}>"

    Return New DirectoryEntry(String.Format(sidBindingFormat, id.Value))
End Function

关于directoryentry - 给定用户的 SID,我如何获取 AD DirectoryEntry?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7090179/

相关文章:

c# - 如何知道我的 DirectoryEntry 是否真的连接到我的 LDAP 目录?

c++ - 接收用户所属的所有成员组的 SID?

c++ - 为什么 ConvertStringSidToSid 转换字符串 SID 失败?

oracle - 使用Oracle SQLDeveloper时SID和服务名称有什么区别?

c# - 获取机器 SID(包括主域 Controller )

Oracle 18c XE : Connecting to a PDB using SID (for legacy application)

vb.net - "new DirectoryEntry(distinguishedName as string)"不是 't work when DN contains a "/"

c# - 我可以加快此查询以检索域中的所有计算机吗?

c# - 从 DirectorySearcher 获取 6000 条记录中的 2000 条

c# - 如何在c#代码中在iis 5.1中添加新的应用程序池?