Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个现有的 DirectoryEntry 连接,我想检查用于创建此 DirectoryEntry 的用户是否属于特定组。任何人都知道如何实现这一目标?
谢谢,舒基
我不认为有任何魔法,简单的方法可以做到这一点......
在DirectoryEntry对象上,您确实有一个UserName属性,如果提供了特定用户,则该属性应包含用于创建此条目的用户的名称。使用该用户名,您可以进行目录查找并找到该用户并检查该用户是否属于该Administrators组(或任何其他组) - 但它并不完全是单行的。
DirectoryEntry
UserName
Administrators