# Simple way to make sure user is in a Group

**URL:** <https://forums.thehomestack.io/t/simple-way-to-make-sure-user-is-in-a-group/178>\
**Category:** vb.Net\
**Created:** [November 27, 2004, 10:00pm UTC](https://forums.thehomestack.io/t/simple-way-to-make-sure-user-is-in-a-group/178 "2004-11-27T22:00:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://forums.thehomestack.io/uploads/default/original/1X/161426793bc0d8bdf0d1a6692b3e44446861cc72.jpeg) [@system](https://forums.thehomestack.io/u/system)\
**Post date:** [November 27, 2004, 10:00pm UTC](https://forums.thehomestack.io/t/simple-way-to-make-sure-user-is-in-a-group/178/1 "2004-11-27T22:00:06Z")

</div>

This is very simple, no need to re-authenticate to do this. I used this to make sure that the user is in a group to give access to this option.

User has to be in Group := “Domain”\Plant Supervisors

```auto

Import System.Security.Principal

Dim curUser As New Security.Principal.WindowsPrincipal(Security.Principal.WindowsIdentity.GetCurrent)

If curUser.IsInRole(Environment.UserDomainName & "\Plant Supervisors") = True Then

'Do what ever
Else
'Do whatever
End if

```

Enjoy!
