Click here to Skip to main content
Click here to Skip to main content

Updating Windows Security Groups using VB.NET and Directory Services

, 22 Dec 2004
Rate this:
Please Sign up or sign in to vote.
How to use directory services to manage group level security. Easily Add, Remove and List users in a Windows domain security group. Note: You must be a Domain Admin to use this code.

Introduction

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)
Obj.RemoveUser("UserName")

That's basically it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

spidur1
Web Developer
United States United States
Todd is currently working at PA Lumbermens as a .net programmer.

Comments and Discussions

 
Generalwindows authentication PinmemberBMWABCD18-Jan-07 11:07 
Questionfinding Domain Name, Server Name & Group Name PinmemberJwalant Natvarlal Soneji21-Dec-05 18:56 
Generalaccess denied Pinmemberfirstmaster27-Oct-05 15:56 
GeneralRe: access denied PinmemberToddHileHoffer29-Oct-05 14:35 
GeneralSecurity PinmemberPradeep Panzade20-Feb-05 18:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web01 | 2.8.140709.1 | Last Updated 22 Dec 2004
Article Copyright 2004 by spidur1
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid