Active Directory

  • Thread starter Thread starter Ed Willis
  • Start date Start date
E

Ed Willis

I have a list of groups. I want to see if a user is in a group on our
domain. How do I do that?

Thanks
 
Imports System.Security.Principal

Private Function InGroup(ByVal grp As String) As Boolean
Dim id As WindowsIdentity
id = WindowsIdentity.GetCurrent()
Dim p As New WindowsPrincipal(id)
InGroup = p.IsInRole("YourDomainName\" + grp)
End Function
 
Will this only check to see if the current user logged in is in that
particular group?

I want to be able to check the domain to see if any user is in a group?

Thanks.
 
Yes. That just checks the current user against a group. Don't quite see
what you're trying to do though and what you mean by "any user is in a
group?" You're after a count of the number of members? Probably worth a
repost with more detail about what you're trying to do.
 
Will this only check to see if the current user logged in is in that
particular group?

I want to be able to check the domain to see if any user is in a group?

I have a list of users and groups. I want to show what users are in what
groups in the domain.

Thanks.
 
Back
Top