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
Bonnie Smith
NA
9
0
Delete security group in Active Directory
Apr 26 2010 10:53 AM
I have to delete a group from Active Directory. I have create & list users working correctly and have tried many different instances of deleting group, but none have worked. Here is my current c# code, where "path" is a string read from settings.xml successfully:
public StatusObject DeleteADGroup(string user_id, string groupName, string password, string domain){
StatusObject status = new StatusObject(ClassName);
sting domainAndUserName = domain + @"\" + user_id;
if(DoesGroupExist(groupName)){
try{
DirectoryEntry entry = new DirectoryEntry("LDAP://" + path, domainAndUserName, password);
DirectoryEntry group = entry.Children.Find("CN=" + groupName, "group");
entry.Children.Remove(group);
group.CommitChanges();
status.Successful = true;
catch(Exception ex) {
// log error handling
}
else{
status.Successful = false;
//false handling
}
return status;
}
Any suggestions or help would be greatly appreciated! I've been working on this for what seems like an eternity!! Thank you!
blskv
Reply
Answers (
0
)
mcts 70-562
How to disable browser back button