This is the easiest way to determine if a user belongs to particular Active Directory user group using VB.NET without having to enumerate through all the user’s groups.
Public Function IsInGroup(ByVal GroupName As String) As Boolean Dim MyIdentity As System.Security.Principal.WindowsIdentity = System.Security.Principal.WindowsIdentity.GetCurrent() Dim MyPrincipal As System.Security.Principal.WindowsPrincipal = New System.Security.Principal.WindowsPrincipal(MyIdentity) Return MyPrincipal.IsInRole(GroupName) End Function