TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Andre
NA
11
0
Adding a Active Directory user to a local group.
Oct 11 2006 7:43 AM
Hi everyone,
I've searched alot of code samples of how to add Active Directory users to a local group.
I got now the following code:
GroupName = TestGroup
UserName = mod\u00p3n4
using DirectoryServices;
public void addUserToGroup(string GroupName, string UserName)
{
DirectoryEntry _groupEntry;
DirectoryEntry _group;
DirectoryEntry _usr;
try
{
_groupEntry = new DirectoryEntry("WinNT://" + Environment.MachineName);
_group = _groupEntry.Children.Find(GroupName);
_usr = _group.Children.Find(UserName)
_group.CommitChanges();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
Reply
Answers (
0
)
Extract Public/Private key from P12 or PFX File
username password login authorization in C-sharp