Do you use Integrated Windows Security to manage permissions in your applications and or databases? The class AD_Group.vb provided in this sample project will let you easily Add, Remove and List users in a Windows group. My development group uses group security in our ASP.NET applications using the
User.IsInRole ("Domain\Group") function all the time. We also set permissions to our web directories at the group level. Now we manage our groups easily with VB.NET code. It's a lot quicker than logging on to our DC server and using the Active Directory GUI provided in Windows Server 2000. The Windows application pictured below is one way I put the AD_Group.vb class to good use.
To use this code, add a reference to the DirectoryServices.dll:
After your reference has been added, simply Add Existing Item to your project. Add the AD_Group.vb file contained in this sample project like so:
Then you can call the code like this:
Dim Obj AsNew AD_Group(MyDomain, MyServer, MyGroup)
That's basically it.