How to programmatically figure out if a user account is a member of a particular group in Windows?

后端 未结 3 1482
夕颜
夕颜 2020-12-17 05:39

Given a group name and a user account, I would like to know if the supplied user belongs to a particular group. The user can be a local user or a domain user and the group c

3条回答
  •  温柔的废话
    2020-12-17 05:58

    UserPrincipal.IsMemberOf(GroupPrincipal) "returns a Boolean value that specifies whether the principal is a member of the specified group".

提交回复
热议问题