string name = "#ABC"; public void Create(string ouPath, string name) { if (!DirectoryEntry.Exists("LDAP://CN=" + name + "," + ouPath)) { try { DirectoryEntry entry = new DirectoryEntry("LDAP://" + ouPath); DirectoryEntry group = entry.Children.Add("CN=" + name, "group"); group.Properties["sAmAccountName"].Value = name; group.CommitChanges(); } catch (Exception e) { Console.WriteLine(e.Message.ToString()); } } else { Console.WriteLine(path + " already exists"); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)